Class: MemDB::Field::MayMissing

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

Defined Under Namespace

Classes: Any

Constant Summary collapse

ANY_MATCHING =
Any.new

Instance Method Summary collapse

Methods included from MemDB::Field

#downcase, #may_missing, #negative, #query

Constructor Details

#initialize(original) ⇒ MayMissing

Returns a new instance of MayMissing.



21
22
23
# File 'lib/mem_db/field/may_missing.rb', line 21

def initialize(original)
  @original = original
end

Instance Method Details

#fieldObject



25
26
27
# File 'lib/mem_db/field/may_missing.rb', line 25

def field
  @original.field
end

#field_value(obj) ⇒ Object



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

def field_value(obj)
  if obj[field].nil?
    nil
  else
    @original.field_value(obj)
  end
end

#new_matching(value) ⇒ Object



33
34
35
36
37
38
39
# File 'lib/mem_db/field/may_missing.rb', line 33

def new_matching(value)
  if value.nil?
    ANY_MATCHING
  else
    @original.new_matching(value)
  end
end

#prepare_query(obj) ⇒ Object



49
50
51
# File 'lib/mem_db/field/may_missing.rb', line 49

def prepare_query(obj)
  @original.prepare_query(obj)
end

#query_fieldObject



29
30
31
# File 'lib/mem_db/field/may_missing.rb', line 29

def query_field
  @original.query_field
end