Class: Groonga::Client::Response::Schema
- Defined in:
- lib/groonga/client/response/schema.rb
Overview
The response class for schema
command.
Defined Under Namespace
Modules: HashValueConverter Classes: Column, Command, Index, KeyType, Normalizer, Plugin, Table, TokenFilter, Tokenizer, Type, ValueType
Instance Attribute Summary
Attributes inherited from Base
#body, #command, #header, #raw, #trace_logs
Instance Method Summary collapse
-
#[](name) ⇒ Plugin, ...
The object named
name
. -
#normalizers ⇒ Hash<String, Normalizer>
Key is normalizer name and value is the definition of the normalizer.
-
#plugins ⇒ Hash<String, Plugin>
Key is plugin name and value is the definition of the plugin.
-
#tables ⇒ Hash<String, Table>
Key is table name and value is the definition of the table.
-
#token_filters ⇒ Hash<String, TokenFilter>
Key is token filter name and value is the definition of the token filter.
-
#tokenizers ⇒ Hash<String, Tokenizer>
Key is tokenizer name and value is the definition of the tokenizer.
-
#types ⇒ Hash<String, Type>
Key is type name and value is the definition of the type.
Methods inherited from Base
#elapsed_time, #error_message, #initialize, parse, #return_code, #start_time, #status_code, #success?
Constructor Details
This class inherits a constructor from Groonga::Client::Response::Base
Instance Method Details
#[](name) ⇒ Plugin, ...
Returns The object named name
.
105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/groonga/client/response/schema.rb', line 105 def [](name) name = name.to_s if name.is_a?(Symbol) if name.include?(".") table_name, column_name = name.split(".", 2) tables[table_name].columns[column_name] else tables[name] || types[name] || tokenizers[name] || normalizers[name] || token_filters[name] || plugins[name] end end |
#normalizers ⇒ Hash<String, Normalizer>
Returns Key is normalizer name and value is the definition of the normalizer.
62 63 64 65 66 |
# File 'lib/groonga/client/response/schema.rb', line 62 def normalizers @normalizers ||= HashValueConverter.convert(@body["normalizers"]) do |normalizer| Normalizer[normalizer] end end |
#plugins ⇒ Hash<String, Plugin>
Returns Key is plugin name and value is the definition of the plugin.
32 33 34 35 36 |
# File 'lib/groonga/client/response/schema.rb', line 32 def plugins @plugins ||= HashValueConverter.convert(@body["plugins"]) do |raw_plugin| Plugin[raw_plugin] end end |
#tables ⇒ Hash<String, Table>
Returns Key is table name and value is the definition of the table.
82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/groonga/client/response/schema.rb', line 82 def tables @tables ||= nil return @tables if @tables @tables = {} @body["tables"].each do |key, _| @tables[key] = Table.new(self) end @body["tables"].each do |key, raw_table| table = @tables[key] raw_table.each do |table_key, table_value| table[table_key] = table_value end end @tables end |
#token_filters ⇒ Hash<String, TokenFilter>
Returns Key is token filter name and value is the definition of the token filter.
72 73 74 75 76 |
# File 'lib/groonga/client/response/schema.rb', line 72 def token_filters @token_filters ||= HashValueConverter.convert(@body["token_filters"]) do |token_filter| TokenFilter[token_filter] end end |
#tokenizers ⇒ Hash<String, Tokenizer>
Returns Key is tokenizer name and value is the definition of the tokenizer.
52 53 54 55 56 |
# File 'lib/groonga/client/response/schema.rb', line 52 def tokenizers @tokenizers ||= HashValueConverter.convert(@body["tokenizers"]) do |tokenizer| Tokenizer[tokenizer] end end |
#types ⇒ Hash<String, Type>
Returns Key is type name and value is the definition of the type.
42 43 44 45 46 |
# File 'lib/groonga/client/response/schema.rb', line 42 def types @types ||= HashValueConverter.convert(@body["types"]) do |raw_type| Type[raw_type] end end |