digital-fabric / polyphony

Fine-grained concurrency for Ruby
https://www.rubydoc.info/gems/polyphony
MIT License
655 stars 17 forks source link

IO#each_line: return enumerator when no block is given #123

Closed floriandejonckheere closed 8 months ago

floriandejonckheere commented 8 months ago

Keep the behaviour of IO#each_line consistent with Ruby's implementation: return an Enumerator when no block is given.

# Before
File.open("myfile.txt", "r").each_line
/usr/local/bundle/gems/polyphony-1.6/lib/polyphony/extensions/io.rb:322:in `each_line': no block given (yield) (LocalJumpError)

# After
File.open("myfile.txt", "r").each_line
 => #<Enumerator: ...>