Class: Leftovers::Matchers::NodeHasAnyPositionalArgumentWithValue

Inherits:
Object
  • Object
show all
Includes:
ComparableInstance
Defined in:
lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(matcher) ⇒ NodeHasAnyPositionalArgumentWithValue

Returns a new instance of NodeHasAnyPositionalArgumentWithValue.



10
11
12
13
14
# File 'lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb', line 10

def initialize(matcher)
  @matcher = matcher

  freeze
end

Instance Attribute Details

#matcherObject (readonly)

Returns the value of attribute matcher.



8
9
10
# File 'lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb', line 8

def matcher
  @matcher
end

Instance Method Details

#===(node) ⇒ Object



16
17
18
# File 'lib/leftovers/matchers/node_has_any_positional_argument_with_value.rb', line 16

def ===(node)
  node.positional_arguments&.any?(@matcher)
end