We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 4bf2ce7 commit 0aa02b3Copy full SHA for 0aa02b3
lib/sqlite3/resultset.rb
@@ -54,6 +54,7 @@ def each
54
# Provides an internal iterator over the rows of the result set where
55
# each row is yielded as a hash.
56
def each_hash
57
+ return enum_for(__method__) unless block_given?
58
while (node = next_hash)
59
yield node
60
end
test/test_result_set.rb
@@ -24,6 +24,12 @@ def test_each_hash
24
assert_equal list[hash["a"] - 1], hash["b"]
25
26
rs.close
27
+
28
+ rs = @db.prepare("select * from foo").execute
29
+ rs.each_hash.to_a do |hash|
30
+ assert_equal list[hash["a"] - 1], hash["b"]
31
+ end
32
+ rs.close
33
34
35
def test_next_hash
0 commit comments