class Groonga::Client::Response::Schema

The response class for ‘schema` command.

@since 0.2.2

Public Instance Methods

[](name) click to toggle source

@param name [String] The object name to be retrieved.

@return [Plugin, Type, Tokenizer, Normalizer, TokenFilter, Table, Column]

The object named `name`.

@since 0.5.3

# 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() click to toggle source

@return [Hash<String, Normalizer>] Key is normalizer name and

value is the definition of the normalizer.

@since 0.2.3

# File lib/groonga/client/response/schema.rb, line 62
def normalizers
  @normalizers ||= HashValueConverter.convert(@body["normalizers"]) do |normalizer|
    Normalizer[normalizer]
  end
end
plugins() click to toggle source

@return [Hash<String, Plugin>] Key is plugin name and

value is the definition of the plugin.

@since 0.3.6

# 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() click to toggle source

@return [Hash<String, Table>] Key is table name and value is the

definition of the table.

@since 0.2.2

# 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() click to toggle source

@return [Hash<String, TokenFilter>] Key is token filter name and

value is the definition of the token filter.

@since 0.2.3

# 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() click to toggle source

@return [Hash<String, Tokenizer>] Key is tokenizer name and

value is the definition of the tokenizer.

@since 0.2.2

# File lib/groonga/client/response/schema.rb, line 52
def tokenizers
  @tokenizers ||= HashValueConverter.convert(@body["tokenizers"]) do |tokenizer|
    Tokenizer[tokenizer]
  end
end
types() click to toggle source

@return [Hash<String, Type>] Key is type name and

value is the definition of the type.

@since 0.2.2

# File lib/groonga/client/response/schema.rb, line 42
def types
  @types ||= HashValueConverter.convert(@body["types"]) do |raw_type|
    Type[raw_type]
  end
end