Class: MemDB::Field::Regexp

Inherits:
Object
  • Object
show all
Includes:
MemDB::Field
Defined in:
lib/mem_db/field/regexp.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, rx_engine: MemDB::RegexpEngines::Std, ignore_case: false) ⇒ Regexp

Returns a new instance of Regexp.


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

def initialize(field, rx_engine: MemDB::RegexpEngines::Std, ignore_case: false)
  @field = field
  @rx_engine = rx_engine
  @ignore_case = ignore_case
end

Instance Attribute Details

#fieldObject (readonly)

Returns the value of attribute field.


36
37
38
# File 'lib/mem_db/field/regexp.rb', line 36

def field
  @field
end

Instance Method Details

#new_matching(value) ⇒ Object


44
45
46
47
48
49
50
# File 'lib/mem_db/field/regexp.rb', line 44

def new_matching(value)
  if value.is_a?(Array)
    MultiMatching.new(value, rx_engine: @rx_engine, ignore_case: @ignore_case)
  else
    SingleMatching.new(value, rx_engine: @rx_engine, ignore_case: @ignore_case)
  end
end