Method: Machinery::ElementFilter#initialize

Defined in:
lib/element_filter.rb

#initialize(path, operator = nil, matchers = nil) ⇒ ElementFilter

Returns a new instance of ElementFilter.



21
22
23
24
25
26
27
28
29
30
# File 'lib/element_filter.rb', line 21

def initialize(path, operator = nil, matchers = nil)
  @path = path
  @matchers = {}

  unless [NilClass, String, Array].include?(matchers.class)
    raise Machinery::Errors::InvalidFilter.new("Wrong filter type")
  end

  add_matchers(operator, matchers) if operator && matchers
end