Class: Leftovers::Processors::KeywordArgument
- Inherits:
-
Object
- Object
- Leftovers::Processors::KeywordArgument
- Includes:
- ComparableInstance
- Defined in:
- lib/leftovers/processors/keyword_argument.rb
Instance Method Summary collapse
-
#initialize(matcher, then_processor) ⇒ KeywordArgument
constructor
A new instance of KeywordArgument.
- #process(_str, current_node, matched_node, acc) ⇒ Object
Methods included from ComparableInstance
Constructor Details
#initialize(matcher, then_processor) ⇒ KeywordArgument
Returns a new instance of KeywordArgument.
8 9 10 11 12 13 |
# File 'lib/leftovers/processors/keyword_argument.rb', line 8 def initialize(matcher, then_processor) @matcher = matcher @then_processor = then_processor freeze end |
Instance Method Details
#process(_str, current_node, matched_node, acc) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/leftovers/processors/keyword_argument.rb', line 15 def process(_str, current_node, matched_node, acc) kwargs = current_node.kwargs return unless kwargs kwargs.children.each do |pair| next unless @matcher === pair value_node = pair.second @then_processor.process(value_node.to_literal_s, value_node, matched_node, acc) end end |