Class: Leftovers::Matchers::NodeHasPositionalArgument

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

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(position) ⇒ NodeHasPositionalArgument

Returns a new instance of NodeHasPositionalArgument.



8
9
10
11
12
# File 'lib/leftovers/matchers/node_has_positional_argument.rb', line 8

def initialize(position)
  @position = position

  freeze
end

Instance Method Details

#===(node) ⇒ Object



14
15
16
17
18
# File 'lib/leftovers/matchers/node_has_positional_argument.rb', line 14

def ===(node)
  args = node.positional_arguments

  args.length > @position if args
end