Class: Droonga::Catalog::Schema::Table

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, data) ⇒ Table

Returns a new instance of Table.



108
109
110
111
112
113
114
115
116
# File 'lib/droonga/catalog/schema.rb', line 108

def initialize(name, data)
  @name = name
  @data = data
  @columns = {}

  columns_data.each do |column_name, column_data|
    @columns[column_name] = Column.new(name, column_name, column_data)
  end
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



107
108
109
# File 'lib/droonga/catalog/schema.rb', line 107

def columns
  @columns
end

#dataObject (readonly)

Returns the value of attribute data.



107
108
109
# File 'lib/droonga/catalog/schema.rb', line 107

def data
  @data
end

#nameObject (readonly)

Returns the value of attribute name.



107
108
109
# File 'lib/droonga/catalog/schema.rb', line 107

def name
  @name
end

Instance Method Details

#==(other) ⇒ Object



118
119
120
121
122
# File 'lib/droonga/catalog/schema.rb', line 118

def ==(other)
  self.class == other.class and
    name == other.name and
    data == other.data
end

#key_typeObject



141
142
143
# File 'lib/droonga/catalog/schema.rb', line 141

def key_type
  @data["keyType"]
end

#key_type_groongaObject



145
146
147
148
149
150
151
152
153
154
# File 'lib/droonga/catalog/schema.rb', line 145

def key_type_groonga
  case key_type
  when "Integer"
    "Int64"
  when "Float", "Time", "ShortText", "TokyoGeoPoint", "WGS84GeoPoint"
    key_type
  else
    key_type
  end
end

#normalizerObject



160
161
162
# File 'lib/droonga/catalog/schema.rb', line 160

def normalizer
  @data["normalizer"]
end

#tokenizerObject



156
157
158
# File 'lib/droonga/catalog/schema.rb', line 156

def tokenizer
  @data["tokenizer"]
end

#typeObject



124
125
126
# File 'lib/droonga/catalog/schema.rb', line 124

def type
  @data["type"] || "Hash"
end

#type_symbolObject



128
129
130
131
132
133
134
135
136
137
138
139
# File 'lib/droonga/catalog/schema.rb', line 128

def type_symbol
  case type
  when "Array"
    :array
  when "Hash"
    :hash
  when "PatriciaTrie"
    :patricia_trie
  when "DoubleArrayTrie"
    :double_array_trie
  end
end