Class: ETL::Processor::FilterRowProcessor
- Inherits:
-
RowProcessor
- Object
- Processor
- RowProcessor
- ETL::Processor::FilterRowProcessor
- Defined in:
- lib/etl/processor/filter_row_processor.rb
Instance Attribute Summary collapse
-
#condition ⇒ Object
readonly
Returns the value of attribute condition.
-
#outfalse ⇒ Object
readonly
Returns the value of attribute outfalse.
-
#outtrue ⇒ Object
readonly
Returns the value of attribute outtrue.
Instance Method Summary collapse
-
#initialize(control, configuration) ⇒ FilterRowProcessor
constructor
A new instance of FilterRowProcessor.
- #process(row) ⇒ Object
Methods inherited from RowProcessor
#ensure_columns_available_in_row!
Constructor Details
#initialize(control, configuration) ⇒ FilterRowProcessor
Returns a new instance of FilterRowProcessor.
8 9 10 11 12 13 |
# File 'lib/etl/processor/filter_row_processor.rb', line 8 def initialize(control, configuration) @condition = configuration[:condition] @outtrue = configuration[:outtrue] @outfalse = configuration[:outfalse] super end |
Instance Attribute Details
#condition ⇒ Object (readonly)
Returns the value of attribute condition.
4 5 6 |
# File 'lib/etl/processor/filter_row_processor.rb', line 4 def condition @condition end |
#outfalse ⇒ Object (readonly)
Returns the value of attribute outfalse.
6 7 8 |
# File 'lib/etl/processor/filter_row_processor.rb', line 6 def outfalse @outfalse end |
#outtrue ⇒ Object (readonly)
Returns the value of attribute outtrue.
5 6 7 |
# File 'lib/etl/processor/filter_row_processor.rb', line 5 def outtrue @outtrue end |
Instance Method Details
#process(row) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/etl/processor/filter_row_processor.rb', line 15 def process(row) return nil if row.nil? if eval_condition(row, @condition) return [] if @outtrue.nil? eval(@outtrue) else eval(@outfalse) unless @outfalse.nil? end return row end |