Class: MemDB::Field::Regexp::MultiMatching
- Inherits:
-
Object
- Object
- MemDB::Field::Regexp::MultiMatching
- Includes:
- Matching
- Defined in:
- lib/mem_db/field/regexp.rb
Instance Method Summary collapse
-
#initialize(arr, rx_engine:, ignore_case:) ⇒ MultiMatching
constructor
A new instance of MultiMatching.
- #match?(values) ⇒ Boolean
Constructor Details
#initialize(arr, rx_engine:, ignore_case:) ⇒ MultiMatching
Returns a new instance of MultiMatching.
15 16 17 |
# File 'lib/mem_db/field/regexp.rb', line 15 def initialize(arr, rx_engine:, ignore_case:) @patterns = arr.map { |source| rx_engine.new(source, ignore_case: ignore_case) } end |
Instance Method Details
#match?(values) ⇒ Boolean
19 20 21 |
# File 'lib/mem_db/field/regexp.rb', line 19 def match?(values) values.any? { |str| @patterns.any? { |pat| pat.match?(str) } } end |