class AgnosticBackend::Indexable::FieldType

Constants

BOOLEAN
DATE
DATE_ARRAY
DOUBLE
INTEGER
STRING
STRING_ARRAY
STRUCT
TEXT
TEXT_ARRAY

Attributes

options[R]
type[R]

Public Class Methods

all() click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 15
def self.all
  constants.map { |constant| const_get(constant) }
end
exists?(type) click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 19
def self.exists?(type)
  all.include? type
end
new(type, **options) click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 25
def initialize(type, **options)
  raise "Type #{type} not supported" unless FieldType.exists? type
  @type = type
  @options = options
end

Public Instance Methods

get_option(option_name) click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 39
def get_option(option_name)
  @options[option_name.to_sym]
end
has_option(option_name) click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 43
def has_option(option_name)
  @options.has_key? option_name.to_sym
end
matches?(type) click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 35
def matches?(type)
  self.type == type
end
nested?() click to toggle source
# File lib/agnostic_backend/indexable/field_type.rb, line 31
def nested?
  type == STRUCT
end