Class: ETL::Processor::RowProcessor
- Defined in:
- lib/etl/processor/row_processor.rb
Overview
Processor which processes a specific row. Unlike a transformer, which deals with a specific value in the row, row processors can process an entire row at once, which can be used to explode a single row into multiple rows (for example)
Direct Known Subclasses
BlockProcessor, CheckExistProcessor, CheckUniqueProcessor, CopyFieldProcessor, DatabaseJoinProcessor, EnsureFieldsPresenceProcessor, FilterRowProcessor, HierarchyExploderProcessor, PrintRowProcessor, RenameProcessor, RequireNonBlankProcessor, SequenceProcessor, SurrogateKeyProcessor
Instance Method Summary collapse
-
#ensure_columns_available_in_row!(row, columns, message) ⇒ Object
Ensure a given row keys include all the provided columns and raise an error using the provided message if it doesn’t.
-
#initialize(control, configuration) ⇒ RowProcessor
constructor
Initialize the processor.
-
#process(row) ⇒ Object
Process the specified row.
Constructor Details
#initialize(control, configuration) ⇒ RowProcessor
Initialize the processor
8 9 10 |
# File 'lib/etl/processor/row_processor.rb', line 8 def initialize(control, configuration) super end |
Instance Method Details
#ensure_columns_available_in_row!(row, columns, message) ⇒ Object
Ensure a given row keys include all the provided columns and raise an error using the provided message if it doesn’t
18 19 20 21 22 23 24 |
# File 'lib/etl/processor/row_processor.rb', line 18 def ensure_columns_available_in_row!(row, columns, ) unless columns.nil? columns.each do |k| raise(ETL::ControlError, "Row missing required field #{k.inspect} #{}") unless row.keys.include?(k) end end end |
#process(row) ⇒ Object
Process the specified row. This method must return the row.
12 13 14 |
# File 'lib/etl/processor/row_processor.rb', line 12 def process(row) raise "process_row is an abstract method" end |