Class: Droonga::Catalog::Schema::Table
- Inherits:
-
Object
- Object
- Droonga::Catalog::Schema::Table
- Defined in:
- lib/droonga/catalog/schema.rb
Instance Attribute Summary collapse
-
#columns ⇒ Object
readonly
Returns the value of attribute columns.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(name, raw) ⇒ Table
constructor
A new instance of Table.
- #key_type ⇒ Object
- #key_type_groonga ⇒ Object
- #normalizer ⇒ Object
- #tokenizer ⇒ Object
- #type ⇒ Object
- #type_symbol ⇒ Object
Constructor Details
#initialize(name, raw) ⇒ 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, raw) @name = name @raw = raw @columns = {} raw_columns.each do |column_name, raw_column| @columns[column_name] = Column.new(name, column_name, raw_column) end end |
Instance Attribute Details
#columns ⇒ Object (readonly)
Returns the value of attribute columns.
107 108 109 |
# File 'lib/droonga/catalog/schema.rb', line 107 def columns @columns end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
107 108 109 |
# File 'lib/droonga/catalog/schema.rb', line 107 def name @name end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
107 108 109 |
# File 'lib/droonga/catalog/schema.rb', line 107 def raw @raw 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 raw == other.raw end |
#key_type ⇒ Object
141 142 143 |
# File 'lib/droonga/catalog/schema.rb', line 141 def key_type @raw["keyType"] end |
#key_type_groonga ⇒ Object
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 |
#normalizer ⇒ Object
160 161 162 |
# File 'lib/droonga/catalog/schema.rb', line 160 def normalizer @raw["normalizer"] end |
#tokenizer ⇒ Object
156 157 158 |
# File 'lib/droonga/catalog/schema.rb', line 156 def tokenizer @raw["tokenizer"] end |
#type ⇒ Object
124 125 126 |
# File 'lib/droonga/catalog/schema.rb', line 124 def type @raw["type"] || "Hash" end |
#type_symbol ⇒ Object
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 |