Module: MemDB::Field

Included in:
Downcase, Enum, MayMissing, Negative, Pattern, Regexp
Defined in:
lib/mem_db/field.rb,
lib/mem_db/field/enum.rb,
lib/mem_db/field/regexp.rb,
lib/mem_db/field/pattern.rb,
lib/mem_db/field/downcase.rb,
lib/mem_db/field/matching.rb,
lib/mem_db/field/negative.rb,
lib/mem_db/field/may_missing.rb

Defined Under Namespace

Modules: Matching Classes: Downcase, Enum, MayMissing, Negative, Pattern, Regexp

Instance Method Summary collapse

Instance Method Details

#downcaseObject


13
14
15
# File 'lib/mem_db/field.rb', line 13

def downcase
  MemDB::Field::Downcase.new(self)
end

#fieldObject

Raises:

  • (NotImplementedError)

17
18
19
# File 'lib/mem_db/field.rb', line 17

def field
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#field_value(obj) ⇒ Object


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

def field_value(obj)
  obj[field]
end

#may_missingObject


5
6
7
# File 'lib/mem_db/field.rb', line 5

def may_missing
  MemDB::Field::MayMissing.new(self)
end

#negativeObject


9
10
11
# File 'lib/mem_db/field.rb', line 9

def negative
  MemDB::Field::Negative.new(self)
end

#new_matching(_value) ⇒ Object

Raises:

  • (NotImplementedError)

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

def new_matching(_value)
  raise NotImplementedError, "#{self.class} has not implemented method '#{__method__}'"
end

#prepare_query(query) ⇒ Object


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

def prepare_query(query)
  query[query_field]
end

#query(query_field) ⇒ Object


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

def query(query_field)
  @query_field = query_field
  self
end

#query_fieldObject


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

def query_field
  @query_field || field
end