Sha256: 2ae5be11d885312a325d795825d36dda77ea8364a0967c8c1b600692f24e40e3

Contents?: true

Size: 786 Bytes

Versions: 2

Compression:

Stored size: 786 Bytes

Contents

module Groonga
  class Database
    def each
      context = Context.instance
      flags =
        TableCursorFlags::ASCENDING |
        TableCursorFlags::BY_ID
      TableCursor.open(self, :flags => flags) do |cursor|
        cursor.each do |id|
          object = context[id]
          yield(object) if object
        end
      end
    end

    def each_table(options={})
      context = Context.instance
      min = options[:prefix]
      flags =
        TableCursorFlags::ASCENDING |
        TableCursorFlags::BY_KEY
      flags |= TableCursorFlags::PREFIX if min
      TableCursor.open(self, :min => min, :flags => flags) do |cursor|
        cursor.each do |id|
          object = context[id]
          yield(object) if object.is_a?(Table)
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
rroonga-5.0.0-x64-mingw32 vendor/local/lib/groonga/scripts/ruby/database.rb
rroonga-5.0.0-x86-mingw32 vendor/local/lib/groonga/scripts/ruby/database.rb