Class: Groonga::Client::Response::Schema

Inherits:
Base
  • Object
show all
Defined in:
lib/groonga/client/response/schema.rb

Overview

The response class for schema command.

Since:

  • 0.2.2

Defined Under Namespace

Modules: HashValueConverter Classes: Column, Index, KeyType, Normalizer, Table, TokenFilter, Tokenizer, Type, ValueType

Instance Attribute Summary

Attributes inherited from Base

#body, #command, #header, #raw

Instance Method Summary collapse

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

#normalizersHash<String, Normalizer>

Returns Key is normalizer name and value is the definition of the normalizer.

Returns:

  • (Hash<String, Normalizer>)

    Key is normalizer name and value is the definition of the normalizer.

Since:

  • 0.2.3



52
53
54
55
56
# File 'lib/groonga/client/response/schema.rb', line 52

def normalizers
  @normalizers ||= HashValueConverter.convert(@body["normalizers"]) do |normalizer|
    Normalizer[normalizer]
  end
end

#tablesHash<String, Table>

Returns Key is table name and value is the definition of the table.

Returns:

  • (Hash<String, Table>)

    Key is table name and value is the definition of the table.

Since:

  • 0.2.2



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/groonga/client/response/schema.rb', line 72

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_filtersHash<String, TokenFilter>

Returns Key is token filter name and value is the definition of the token filter.

Returns:

  • (Hash<String, TokenFilter>)

    Key is token filter name and value is the definition of the token filter.

Since:

  • 0.2.3



62
63
64
65
66
# File 'lib/groonga/client/response/schema.rb', line 62

def token_filters
  @token_filters ||= HashValueConverter.convert(@body["token_filters"]) do |token_filter|
    TokenFilter[token_filter]
  end
end

#tokenizersHash<String, Tokenizer>

Returns Key is tokenizer name and value is the definition of the tokenizer.

Returns:

  • (Hash<String, Tokenizer>)

    Key is tokenizer name and value is the definition of the tokenizer.

Since:

  • 0.2.2



42
43
44
45
46
# File 'lib/groonga/client/response/schema.rb', line 42

def tokenizers
  @tokenizers ||= HashValueConverter.convert(@body["tokenizers"]) do |tokenizer|
    Tokenizer[tokenizer]
  end
end

#typesHash<String, Type>

Returns Key is type name and value is the definition of the type.

Returns:

  • (Hash<String, Type>)

    Key is type name and value is the definition of the type.

Since:

  • 0.2.2



32
33
34
35
36
# File 'lib/groonga/client/response/schema.rb', line 32

def types
  @types ||= HashValueConverter.convert(@body["types"]) do |raw_type|
    Type[raw_type]
  end
end