Sha256: e9fa72fd1d6c85659c7cae0a42dbba5929a09e7f6ea1d16a3fc0897274c0ae18

Contents?: true

Size: 835 Bytes

Versions: 4

Compression:

Stored size: 835 Bytes

Contents

# frozen_string_literal: true

module Leftovers
  module ProcessorBuilders
    module AddSuffix
      class << self
        def build(argument, then_processor)
          case argument
          when ::Hash then build_hash(argument, then_processor)
          when ::String then ::Leftovers::Processors::AddSuffix.new(argument, then_processor)
            # :nocov:
          else raise Leftovers::UnexpectedCase, "Unhandled value #{argument.inspect}"
            # :nocov:
          end
        end

        private

        def build_hash(argument, then_processor)
          dynamic_suffix = ::Leftovers::ProcessorBuilders::Action.build(
            argument, ::Leftovers::Processors::AppendSym
          )
          ::Leftovers::Processors::AddDynamicSuffix.new(dynamic_suffix, then_processor)
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
leftovers-0.11.1 lib/leftovers/processor_builders/add_suffix.rb
leftovers-0.11.0 lib/leftovers/processor_builders/add_suffix.rb
leftovers-0.10.0 lib/leftovers/processor_builders/add_suffix.rb
leftovers-0.9.0 lib/leftovers/processor_builders/add_suffix.rb