Method: Sanctify::MatcherList#initialize

Defined in:
lib/sanctify/matcher_list.rb

#initialize(custom_matchers:, disabled_matchers:) ⇒ MatcherList

Returns a new instance of MatcherList.



6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/sanctify/matcher_list.rb', line 6

def initialize(custom_matchers:, disabled_matchers:)
  # initialize Array in case users have that field blank
  @disabled_matchers = disabled_matchers || []
  @custom_matchers = custom_matchers || []

  # Create Matcher objects out of const.
  @matchers = DEFAULT_MATCHERS.map do |obj|
    disabled = @disabled_matchers.include?(obj[:id])
    Matcher.new(obj[:id], obj[:description], obj[:regex], disabled: disabled)
  end
  initialize_custom_matchers!
end