Class: MemDB::Field::Pattern
- Inherits:
-
Object
- Object
- MemDB::Field::Pattern
- Includes:
- MemDB::Field
- Defined in:
- lib/mem_db/field/pattern.rb
Defined Under Namespace
Classes: MultiMatching, Pattern, SingleMatching
Instance Attribute Summary collapse
-
#field ⇒ Object
readonly
Returns the value of attribute field.
Instance Method Summary collapse
-
#initialize(field, rx_engine: MemDB::RegexpEngines::Std) ⇒ Pattern
constructor
A new instance of Pattern.
- #new_matching(value) ⇒ Object
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) ⇒ Pattern
Returns a new instance of Pattern.
105 106 107 108 |
# File 'lib/mem_db/field/pattern.rb', line 105 def initialize(field, rx_engine: MemDB::RegexpEngines::Std) @field = field @rx_engine = rx_engine end |
Instance Attribute Details
#field ⇒ Object (readonly)
Returns the value of attribute field.
103 104 105 |
# File 'lib/mem_db/field/pattern.rb', line 103 def field @field end |
Instance Method Details
#new_matching(value) ⇒ Object
110 111 112 113 114 115 116 |
# File 'lib/mem_db/field/pattern.rb', line 110 def new_matching(value) if value.is_a?(Array) MultiMatching.new(value, rx_engine: @rx_engine) else SingleMatching.new(value, rx_engine: @rx_engine) end end |