Class: GroongaClientModel::Schema::Tables
- Inherits:
-
Object
- Object
- GroongaClientModel::Schema::Tables
- Defined in:
- lib/groonga_client_model/schema.rb
Instance Method Summary collapse
- #[](name) ⇒ Object
- #exist?(name) ⇒ Boolean
-
#initialize(raw_schema, raw_tables) ⇒ Tables
constructor
A new instance of Tables.
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
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
48 49 50 |
# File 'lib/groonga_client_model/schema.rb', line 48 def exist?(name) @raw_tables.key?(name) end |