Class: GroongaClientModel::Schema::Tables

Inherits:
Object
  • Object
show all
Defined in:
lib/groonga_client_model/schema.rb

Instance Method Summary collapse

Constructor Details

#initialize(raw_schema, raw_tables) ⇒ Tables

Returns a new instance of Tables.



36
37
38
39
# File 'lib/groonga_client_model/schema.rb', line 36

def initialize(raw_schema, raw_tables)
  @raw_schema = raw_schema
  @raw_tables = raw_tables
end

Instance Method Details

#[](name) ⇒ Object

Raises:



41
42
43
44
45
46
# File 'lib/groonga_client_model/schema.rb', line 41

def [](name)
  name = name.to_s if name.is_a?(Symbol)
  raw_table = @raw_tables[name]
  raise Error, "table doesn't exist: <#{name.inspect}>" if raw_table.nil?
  Table.new(@raw_schema, raw_table)
end

#exist?(name) ⇒ Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/groonga_client_model/schema.rb', line 48

def exist?(name)
  @raw_tables.key?(name)
end