Sha256: 9bcee5b7f16979c1bb47eda0aa209e58e4b3e276c41a2b38e09136bf49540e4c

Contents?: true

Size: 579 Bytes

Versions: 3

Compression:

Stored size: 579 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, configuration={})
        super
        @format = configuration[:format] || "%Y-%m-%d"
      end
      # Transform the value using strftime
      def transform(value)
        value.strftime(@format)
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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