Sha256: a18e580adac09e22b44c1935f7a9afd068b3775b99f2a06a0ce4572e606af0b3

Contents?: true

Size: 780 Bytes

Versions: 3

Compression:

Stored size: 780 Bytes

Contents

module ETL
  module Transform
    class Transform
      class << self
        def transform(name, value, transforms)
          # logger.debug "Transforming field #{name}" if transforms.length > 0
          transforms.each do |transform|
            case transform
            when Proc
              value = transform.call(value)
            when Transform
              value = transform.transform(value)
            else
              raise ControlError, "Unsupported transform configuration type: #{transform}"
            end
          end
          value
        end
      end
      
      attr_reader :control, :configuration
      
      def initialize(control, configuration={})
        @control = control
        @configuration = configuration
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activewarehouse-etl-0.1.0 lib/etl/transform/transform.rb
activewarehouse-etl-0.2.0 lib/etl/transform/transform.rb
activewarehouse-etl-0.3.0 lib/etl/transform/transform.rb