Sha256: b53e935e2666a819f0af252ef04194ea889839b5c15b681a63bb7a509b76db6d

Contents?: true

Size: 596 Bytes

Versions: 9

Compression:

Stored size: 596 Bytes

Contents

module ETL #:nodoc:
  module Transform #:nodoc:
    # Transform a Date or Time to a formatted string instance
    class DateToStringTransform < ETL::Transform::Transform
      # Initialize the transformer.
      #
      # Configuration options:
      # * <tt>:format</tt>: A format passed to strftime. Defaults to %Y-%m-%d
      def initialize(control, name, configuration={})
        super
        @format = configuration[:format] || "%Y-%m-%d"
      end
      # Transform the value using strftime
      def transform(name, value, row)
        value.strftime(@format)
      end
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
activewarehouse-etl-0.7.0 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.7.1 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.7.2 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.8.0 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.8.1 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.8.2 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.8.3 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.8.4 lib/etl/transform/date_to_string_transform.rb
activewarehouse-etl-0.9.0 lib/etl/transform/date_to_string_transform.rb