diff options
Diffstat (limited to '')
-rw-r--r-- | storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb b/storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb new file mode 100644 index 00000000..45949b71 --- /dev/null +++ b/storage/mroonga/vendor/groonga/lib/mrb/scripts/table_cursor.rb @@ -0,0 +1,28 @@ +module Groonga + class TableCursor + include Enumerable + + class << self + def open(*arguments) + cursor = open_raw(*arguments) + if block_given? + begin + yield(cursor) + ensure + cursor.close + end + else + cursor + end + end + end + + def each + loop do + id = self.next + return if id == Groonga::ID::NIL + yield(id) + end + end + end +end |