Class: MemDB::Field::Regexp::MultiMatching

Inherits:
Object
  • Object
show all
Includes:
Matching
Defined in:
lib/mem_db/field/regexp.rb

Instance Method Summary collapse

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

Returns:

  • (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