mirror of
https://github.com/mruby/mruby
synced 2026-06-08 16:11:16 +00:00
Support to return enumerator when no block given
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user