Sha256: c9b0b9e1b40d6ef482b2e8da38221c1c65bac5c374f3631371bd671761d651f7

Contents?: true

Size: 1.21 KB

Versions: 11

Compression:

Stored size: 1.21 KB

Contents

# frozen-string-literal: true

module Leftovers
  module ProcessorBuilders
    module TransformSet
      def self.build(transforms, action)
        each_builder(action).each_or_self(transforms) do |transform|
          case transform
          when ::Hash
            next build(transform[:transforms], action) if transform[:transforms]

            ::Leftovers::ProcessorBuilders::TransformChain.build(transform, build_final(action))
          when ::String
            ::Leftovers::ProcessorBuilders::TransformChain.build(transform, build_final(action))
          # :nocov:
          else raise
            # :nocov:
          end
        end
      end

      def self.each_builder(action)
        case action
        when :call
          ::Leftovers::ProcessorBuilders::Each
        when :define
          ::Leftovers::ProcessorBuilders::EachForDefinitionSet
        # :nocov:
        else raise
          # :nocov:
        end
      end

      def self.build_final(action)
        case action
        when :call
          ::Leftovers::ValueProcessors::ReturnString
        when :define
          ::Leftovers::ValueProcessors::ReturnDefinition
        # :nocov:
        else raise
          # :nocov:
        end
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
leftovers-0.6.0 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.5.5 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.5.4 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.5.3 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.5.2 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.5.1 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.5.0 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.4.3 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.4.2 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.4.1 lib/leftovers/processor_builders/transform_set.rb
leftovers-0.4.0 lib/leftovers/processor_builders/transform_set.rb