[Groonga-commit] groonga/groonga at 457f22a [master] mrb: add Table#each

Back to archive index

Kouhei Sutou null+****@clear*****
Mon Jul 6 16:47:13 JST 2015


Kouhei Sutou	2015-07-06 16:47:13 +0900 (Mon, 06 Jul 2015)

  New Revision: 457f22ac336c1d7eeddf938b8706b8ae8135190e
  https://github.com/groonga/groonga/commit/457f22ac336c1d7eeddf938b8706b8ae8135190e

  Message:
    mrb: add Table#each

  Modified files:
    lib/mrb/scripts/table.rb

  Modified: lib/mrb/scripts/table.rb (+13 -0)
===================================================================
--- lib/mrb/scripts/table.rb    2015-07-06 16:45:03 +0900 (5a1b640)
+++ lib/mrb/scripts/table.rb    2015-07-06 16:47:13 +0900 (36696f4)
@@ -1,5 +1,18 @@
 module Groonga
   class Table
+    include Enumerable
+
+    def each
+      flags =
+        TableCursorFlags::ASCENDING |
+        TableCursorFlags::BY_ID
+      TableCursor.open(self, :flags => flags) do |cursor|
+        cursor.each do |id|
+          yield(id)
+        end
+      end
+    end
+
     def sort(keys, options={})
       offset = options[:offset] || 0
       limit = options[:limit] || -1
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index