Sha256: 0ed212bf56cac5a199489d9f9e3a9a82dbe4adfc7421a3177e9cc4d15f22605b

Contents?: true

Size: 522 Bytes

Versions: 3

Compression:

Stored size: 522 Bytes

Contents

module ETL #:nodoc:
  module Transform #:nodoc:
    # Transform from one type to another
    class TypeTransform < ETL::Transform::Transform
      def initialize(control, configuration={})
        super
        @type = configuration[:type]
      end
      # Transform the value using Time.parse
      def transform(value)
        case @type
        when :string
          value.to_s
        when :number
          value.to_i
        else
          raise "Unsupported type: #{@type}"
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
activewarehouse-etl-0.5.0 lib/etl/transform/type_transform.rb
activewarehouse-etl-0.5.1 lib/etl/transform/type_transform.rb
activewarehouse-etl-0.5.2 lib/etl/transform/type_transform.rb