Class: Machete::Matchers::ArrayMatcher
- Defined in:
- lib/machete/matchers.rb
Instance Attribute Summary collapse
-
#items ⇒ Object
readonly
Returns the value of attribute items.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(items) ⇒ ArrayMatcher
constructor
A new instance of ArrayMatcher.
- #matches?(node) ⇒ Boolean
Constructor Details
#initialize(items) ⇒ ArrayMatcher
Returns a new instance of ArrayMatcher.
61 62 63 |
# File 'lib/machete/matchers.rb', line 61 def initialize(items) @items = items end |
Instance Attribute Details
#items ⇒ Object (readonly)
Returns the value of attribute items.
59 60 61 |
# File 'lib/machete/matchers.rb', line 59 def items @items end |
Instance Method Details
#==(other) ⇒ Object
65 66 67 |
# File 'lib/machete/matchers.rb', line 65 def ==(other) other.instance_of?(self.class) && @items == other.items end |
#matches?(node) ⇒ Boolean
69 70 71 72 73 |
# File 'lib/machete/matchers.rb', line 69 def matches?(node) return false unless node.is_a?(Array) match(@items, node) end |