Class: ETL::Processor::RequireNonBlankProcessor
- Inherits:
-
RowProcessor
- Object
- Processor
- RowProcessor
- ETL::Processor::RequireNonBlankProcessor
- Defined in:
- lib/etl/processor/require_non_blank_processor.rb
Overview
A processor which requires that the particular fields are non-blank in order for the row to be retained.
Instance Attribute Summary collapse
-
#fields ⇒ Object
readonly
An array of fields to check.
Instance Method Summary collapse
-
#initialize(control, configuration) ⇒ RequireNonBlankProcessor
constructor
Initialize the processor.
-
#process(row) ⇒ Object
Process the row.
Methods inherited from RowProcessor
#ensure_columns_available_in_row!
Constructor Details
#initialize(control, configuration) ⇒ RequireNonBlankProcessor
Initialize the processor
Options:
-
:fields
: An array of fields to check, for example:- :first_name,:last_name
14 15 16 17 |
# File 'lib/etl/processor/require_non_blank_processor.rb', line 14 def initialize(control, configuration) super @fields = configuration[:fields] || [] end |
Instance Attribute Details
#fields ⇒ Object (readonly)
An array of fields to check
7 8 9 |
# File 'lib/etl/processor/require_non_blank_processor.rb', line 7 def fields @fields end |
Instance Method Details
#process(row) ⇒ Object
Process the row.
20 21 22 23 |
# File 'lib/etl/processor/require_non_blank_processor.rb', line 20 def process(row) fields.each { |field| return if row[field].blank? } row end |