class GroongaSchema::Table::CommandApplier
Public Class Methods
new(table, command)
click to toggle source
# File lib/groonga-schema/table.rb, line 171 def initialize(table, command) @table = table @command = command end
Public Instance Methods
apply()
click to toggle source
# File lib/groonga-schema/table.rb, line 176 def apply apply_flags apply_key_type apply_value_type apply_default_tokenizer apply_normalizer apply_token_filters end
Private Instance Methods
apply_default_tokenizer()
click to toggle source
# File lib/groonga-schema/table.rb, line 230 def apply_default_tokenizer case @type when :no_key @table.default_tokenizer = nil else @table.default_tokenizer = @command.default_tokenizer end end
apply_flags()
click to toggle source
# File lib/groonga-schema/table.rb, line 186 def apply_flags @type = :no_key @flags = [] @command.flags.each do |flag| parse_flag(flag) end @table.type = @type @table.flags = @flags end
apply_key_type()
click to toggle source
# File lib/groonga-schema/table.rb, line 212 def apply_key_type case @type when :no_key @table.key_type = nil else @table.key_type = @command.key_type || "ShortText" end end
apply_normalizer()
click to toggle source
# File lib/groonga-schema/table.rb, line 239 def apply_normalizer case @type when :no_key @table.normalizer = nil else @table.normalizer = @command.normalizer end end
apply_token_filters()
click to toggle source
# File lib/groonga-schema/table.rb, line 248 def apply_token_filters case @type when :no_key @table.token_filters = [] else @table.token_filters = @command.token_filters end end
apply_value_type()
click to toggle source
# File lib/groonga-schema/table.rb, line 221 def apply_value_type case @type when :dat_key @table.value_type = nil else @table.value_type = @command.value_type end end
parse_flag(flag)
click to toggle source
# File lib/groonga-schema/table.rb, line 197 def parse_flag(flag) case flag when "TABLE_NO_KEY" @type = :no_key when "TABLE_HASH_KEY" @type = :hash_key when "TABLE_PAT_KEY" @type = :pat_key when "TABLE_DAT_KEY" @type = :dat_key else @flags << flag end end