Class: ETL::Transform::StringToDateTimeTransform

Inherits:
Transform
  • Object
show all
Defined in:
lib/etl/transform/string_to_datetime_transform.rb

Overview

Transform a String representation of a date to a DateTime instance

Instance Attribute Summary

Attributes inherited from Transform

#configuration, #control, #name

Instance Method Summary collapse

Methods inherited from Transform

benchmarks, #initialize, transform

Constructor Details

This class inherits a constructor from ETL::Transform::Transform

Instance Method Details

#transform(name, value, row) ⇒ Object

Transform the value using DateTime.parse.

WARNING: This transform is slow (due to the Ruby implementation), but if you need to parse timestamps before or after the values supported by the Time.parse.



9
10
11
# File 'lib/etl/transform/string_to_datetime_transform.rb', line 9

def transform(name, value, row)
  DateTime.parse(value) unless value.nil?
end