Class: MemDB::Field::Enum

Inherits:
Object
  • Object
show all
Includes:
MemDB::Field
Defined in:
lib/mem_db/field/enum.rb

Defined Under Namespace

Classes: MultiMatching, SingleMatching

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from MemDB::Field

#downcase, #field_value, #may_missing, #negative, #prepare_query, #query, #query_field

Constructor Details

#initialize(field) ⇒ Enum

Returns a new instance of Enum.



37
38
39
# File 'lib/mem_db/field/enum.rb', line 37

def initialize(field)
  @field = field
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.



35
36
37
# File 'lib/mem_db/field/enum.rb', line 35

def field
  @field
end

Instance Method Details

#new_matching(value) ⇒ Object



41
42
43
44
45
46
47
# File 'lib/mem_db/field/enum.rb', line 41

def new_matching(value)
  if value.is_a?(Array)
    MultiMatching.new(value)
  else
    SingleMatching.new(value)
  end
end