Skip to content

Allow calling each, each_hash without block - #656

Merged
flavorjones merged 8 commits into
sparklemotion:mainfrom
kch:each_hash_enum
Oct 13, 2026
Merged

flavorjones merged 8 commits into
sparklemotion:mainfrom
kch:each_hash_enum

Conversation

@kch

@kch kch commented Nov 19, 2025 •

Copy link
Copy Markdown
Contributor

Returns an enumerator. Matching similar methods in ruby stdlib.

@kch kch changed the title Allow calling each_hash without block Allow calling each, each_hash without block Nov 19, 2025

@flavorjones flavorjones left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for opening this PR! This is a nice quality-of-life improvement. I have just a couple of comments about the test coverage (which I have been trying to improve with every PR).

Comment thread test/test_result_set.rb Outdated
Comment thread test/test_integration_resultset.rb
Comment thread test/test_integration_resultset.rb
Comment thread lib/sqlite3/resultset.rb Outdated
Comment thread lib/sqlite3/resultset.rb Outdated
@flavorjones

Copy link
Copy Markdown
Member

Sorry for the delay here, I've got a large open-source backlog at the moment and plan to get back to this shortly.

Assert identity with `assert_same`, since `ResultSet` does not define `==`. Drop the `reset` calls, which the identity assertion makes redundant, and the `each_hash` case added to `test_result_set.rb`, which `test_each_hash_enum` covers.
@flavorjones

Copy link
Copy Markdown
Member

Thanks, @kch. I pushed two commits to this branch:

  • A CHANGELOG entry. Returning self from #each also changes what Database#execute and #execute2 return when called with a block: the closed ResultSet instead of nil. The entry calls that out under "Changed".
  • Test cleanups: use assert_same in place of assert_equal, since ResultSet has no ==; drop the reset chaining calls; drop the each_hash addition to test_result_set.rb, which test_each_hash_enum already covers.

@flavorjones
flavorjones enabled auto-merge (squash) October 13, 2026 21:42
@flavorjones
flavorjones merged commit 6067955 into sparklemotion:main Oct 13, 2026
135 checks passed
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