Support to return enumerator when no block given

This commit is contained in:
ksss
2017-03-15 16:51:04 +09:00
parent 673ce237c4
commit 4ee79a8777
+1
View File
@@ -10,6 +10,7 @@ class String
#
# ISO 15.2.10.5.15
def each_line(rs = "\n", &block)
return to_enum(:each_line, rs, &block) unless block
return block.call(self) if rs.nil?
rs = rs.to_str
offset = 0