Sha256: 82ed28927fc9b1f96adf1f6f8dd92c9538354ad14324fc169c96080dc79800a2

Contents?: true

Size: 606 Bytes

Versions: 12

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module ValueProcessors
    class EachKeywordArgument
      def initialize(then_processor)
        @then_processor = then_processor

        freeze
      end

      def process(_str, node, method_node)
        kwargs = node.kwargs
        return unless kwargs

        kwargs.children.map do |pair|
          next unless pair.type == :pair

          argument_node = pair.second
          str = argument_node.to_s if argument_node.string_or_symbol?

          @then_processor.process(str, argument_node, method_node)
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
leftovers-0.7.0 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.6.0 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.5.5 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.5.4 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.5.3 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.5.2 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.5.1 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.5.0 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.4.3 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.4.2 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.4.1 lib/leftovers/value_processors/each_keyword_argument.rb
leftovers-0.4.0 lib/leftovers/value_processors/each_keyword_argument.rb