martijn / xsv

High performance, lightweight .xlsx parser for Ruby that provides nothing a CSV parser wouldn't
https://storck.io/posts/announcing-xsv-1-0-0/
MIT License
194 stars 20 forks source link

Make Sheet#each_row return Enumerator when no block #58

Closed myabc closed 6 months ago

myabc commented 6 months ago

This allows for chaining Enumerators, e.g.

sheet.each.with_index do |row, index|
    # ...
end

and matches behaviour of Array#each/Hash#each

enum = [1, 2, 3].each # => #<Enumerator: ...>
enum.peek # => 1
martijn commented 6 months ago

Great idea, thanks for contributing!