Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make Sheet#each_row return Enumerator when no block #58

Merged
merged 1 commit into from
May 7, 2024

Conversation

myabc
Copy link
Contributor

@myabc myabc commented May 6, 2024

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

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
Copy link
Owner

martijn commented May 7, 2024

Great idea, thanks for contributing!

@martijn martijn merged commit e5d18c6 into martijn:main May 7, 2024
7 checks passed
@myabc myabc deleted the sheet-each_row-enumerator branch May 7, 2024 10:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants