File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -43,22 +43,26 @@ def next
4343 @stmt . step
4444 end
4545
46- # Required by the Enumerable mixin. Provides an internal iterator over the
47- # rows of the result set.
46+ # With a block given, iterates over the rows of the result set, passing each
47+ # to the block. Returns self.
48+ # With no block given, returns a new Enumerator.
4849 def each
4950 return enum_for ( __method__ ) unless block_given?
5051 while ( node = self . next )
5152 yield node
5253 end
54+ self
5355 end
5456
55- # Provides an internal iterator over the rows of the result set where
56- # each row is yielded as a hash.
57+ # With a block given, iterates over the rows of the result set, passing each
58+ # to the block as a hash. Returns self.
59+ # With no block given, returns a new Enumerator.
5760 def each_hash
5861 return enum_for ( __method__ ) unless block_given?
5962 while ( node = next_hash )
6063 yield node
6164 end
65+ self
6266 end
6367
6468 # Closes the statement that spawned this result set.
You can’t perform that action at this time.
0 commit comments