Class: ETL::Processor::CopyFieldProcessor
- Inherits:
-
RowProcessor
- Object
- Processor
- RowProcessor
- ETL::Processor::CopyFieldProcessor
- Defined in:
- lib/etl/processor/copy_field_processor.rb
Overview
Row processor that will copy one field to another
Configuration options:
-
:destination
: The destination field -
:dest
: Alias for :destination -
:source
: The source field
Instance Method Summary collapse
-
#process(row) ⇒ Object
Process the given row.
Methods inherited from RowProcessor
#ensure_columns_available_in_row!, #initialize
Methods inherited from Processor
Constructor Details
This class inherits a constructor from ETL::Processor::RowProcessor
Instance Method Details
#process(row) ⇒ Object
Process the given row
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/etl/processor/copy_field_processor.rb', line 11 def process(row) destination = (configuration[:destination] || configuration[:dest]) source_value = row[configuration[:source]] case source_value when Numeric row[destination] = source_value when nil row[destination] = nil else row[destination] = source_value.dup end row end |