Sha256: 7066e4a9c733377ce0a9d307613304e6bd66891585ce32c1813e09c32cc469fb

Contents?: true

Size: 616 Bytes

Versions: 1

Compression:

Stored size: 616 Bytes

Contents

# frozen_string_literal: true

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

        freeze
      end

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

        Leftovers.map_or_self(kwargs.children) do |pair|
          next unless pair.type == :pair

          argument_node = pair.first
          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

1 entries across 1 versions & 1 rubygems

Version Path
leftovers-0.8.0 lib/leftovers/value_processors/each_keyword.rb