Method: Machinery::ElementFilter#add_matchers

Defined in:
lib/element_filter.rb

#add_matchers(operator, matchers) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
# File 'lib/element_filter.rb', line 36

def add_matchers(operator, matchers)
  unless [
    Machinery::Filter::OPERATOR_EQUALS,
    Machinery::Filter::OPERATOR_EQUALS_NOT
  ].include?(operator)
    raise Machinery::Errors::InvalidFilter.new("Wrong filter operator '#{operator}'")
  end

  @matchers[operator] ||= []
  @matchers[operator] += Array(matchers)
end