Class: ETL::Transform::DefaultTransform
Overview
Transform which will replace nil or empty values with a specified value.
Instance Attribute Summary (collapse)
-
- (Object) default_value
Returns the value of attribute default_value.
Attributes inherited from Transform
#configuration, #control, #name
Instance Method Summary (collapse)
-
- (DefaultTransform) initialize(control, name, configuration)
constructor
Initialize the transform.
-
- (Object) transform(name, value, row)
Transform the value.
Methods inherited from Transform
Constructor Details
- (DefaultTransform) initialize(control, name, configuration)
Initialize the transform
Configuration options:
-
:default_value: The default value to use if the incoming value is blank
10 11 12 13 |
# File 'lib/etl/transform/default_transform.rb', line 10 def initialize(control, name, configuration) super @default_value = configuration[:default_value] end |
Instance Attribute Details
- (Object) default_value
Returns the value of attribute default_value
5 6 7 |
# File 'lib/etl/transform/default_transform.rb', line 5 def default_value @default_value end |
Instance Method Details
- (Object) transform(name, value, row)
Transform the value
15 16 17 |
# File 'lib/etl/transform/default_transform.rb', line 15 def transform(name, value, row) value.blank? ? default_value : value end |