class GroongaSchema::Column::CommandApplier

Public Class Methods

new(column, command) click to toggle source
# File lib/groonga-schema/column.rb, line 159
def initialize(column, command)
  @column = column
  @command = command
end

Public Instance Methods

apply() click to toggle source
# File lib/groonga-schema/column.rb, line 164
def apply
  apply_flags
  apply_value_type
  apply_sources
end

Private Instance Methods

apply_flags() click to toggle source
# File lib/groonga-schema/column.rb, line 171
def apply_flags
  @type = :scalar
  @flags = []
  @command.flags.each do |flag|
    parse_flag(flag)
  end

  @column.type = @type
  @column.flags = @flags
end
apply_sources() click to toggle source
# File lib/groonga-schema/column.rb, line 201
def apply_sources
  case @type
  when :index
    @column.sources = @command.sources
  else
    @column.sources = []
  end
end
apply_value_type() click to toggle source
# File lib/groonga-schema/column.rb, line 195
def apply_value_type
  # TODO: Validate for index column. Index column must have table as
  # value type.
  @column.value_type = @command.type
end
parse_flag(flag) click to toggle source
# File lib/groonga-schema/column.rb, line 182
def parse_flag(flag)
  case flag
  when "COLUMN_SCALAR"
    @type = :scalar
  when "COLUMN_VECTOR"
    @type = :vector
  when "COLUMN_INDEX"
    @type = :index
  else
    @flags << flag
  end
end