Debian Codegraph @

storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb

raw
1 module Groonga
2 class TableCursor
3 include Enumerable
4
5 class << self
6 def open(*arguments)
7 cursor = open_raw(*arguments)
8 if block_given?
9 begin
10 yield(cursor)
11 ensure
12 cursor.close
13 end
14 else
15 cursor
16 end
17 end
18 end
19
20 def each
21 loop do
22 id = self.next
23 return if id == Groonga::ID::NIL
24 yield(id)
25 end
26 end
27 end
28 end