Sha256: 55ce9224fcb4d619cbc699032a197047708572f57128c8270f028dd73e5eb88a

Contents?: true

Size: 578 Bytes

Versions: 1

Compression:

Stored size: 578 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module ValueProcessors
    class AddDynamicPrefix
      def initialize(prefix_processor, then_processor)
        @prefix_processor = prefix_processor
        @then_processor = then_processor

        freeze
      end

      def process(str, node, method_node)
        return unless str

        prefixes = @prefix_processor.process(nil, method_node, method_node)

        Leftovers.map_or_self(prefixes) do |prefix|
          @then_processor.process("#{prefix}#{str}", 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/add_dynamic_prefix.rb