Sha256: 656406cbc1461484edb5c1c565f2cb42a7fcd4fb3d934b56213a2ecc02133591

Contents?: true

Size: 612 Bytes

Versions: 1

Compression:

Stored size: 612 Bytes

Contents

# frozen_string_literal: true

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

        freeze
      end

      def process(_str, node, method_node)
        positional_arguments = node.positional_arguments

        return unless positional_arguments

        Leftovers.map_or_self(positional_arguments) do |argument_node|
          str = argument_node.to_s if argument_node.string_or_symbol_or_def?

          @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_positional_argument.rb