Class: Leftovers::Processors::EachPositionalArgument

Inherits:
Object
  • Object
show all
Includes:
ComparableInstance
Defined in:
lib/leftovers/processors/each_positional_argument.rb

Instance Method Summary collapse

Methods included from ComparableInstance

#eql?, #hash

Constructor Details

#initialize(then_processor) ⇒ EachPositionalArgument

Returns a new instance of EachPositionalArgument.



8
9
10
11
12
# File 'lib/leftovers/processors/each_positional_argument.rb', line 8

def initialize(then_processor)
  @then_processor = then_processor

  freeze
end

Instance Method Details

#process(_str, current_node, matched_node, acc) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/leftovers/processors/each_positional_argument.rb', line 14

def process(_str, current_node, matched_node, acc)
  positional_arguments = current_node.positional_arguments

  return unless positional_arguments

  positional_arguments.each do |argument_node|
    @then_processor.process(argument_node.to_literal_s, argument_node, matched_node, acc)
  end
end