Class: ETL::Transform::StringToDateTransform

Inherits:
Transform show all
Defined in:
lib/etl/transform/string_to_date_transform.rb

Overview

Transform a String representation of a date to a Date 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 Date.parse



6
7
8
9
10
11
12
13
# File 'lib/etl/transform/string_to_date_transform.rb', line 6

def transform(name, value, row)
  return value if value.nil?
  begin
    Date.parse(value)
  rescue => e
    return value
  end
end