Class: CsvPiper::Processors::CollectErrors
- Inherits:
-
Object
- Object
- CsvPiper::Processors::CollectErrors
- Defined in:
- lib/csv_piper/processors/collect_errors.rb
Overview
Collects errors for use after processing. Instantiate and keep a reference, then once processing complete retrieve errors through #errors
Instance Attribute Summary collapse
-
#errors ⇒ Object
readonly
@return Holds all of the errors for each row that was processed { row_index => { errors_key => array_of_errors } }.
Instance Method Summary collapse
-
#initialize ⇒ CollectErrors
constructor
A new instance of CollectErrors.
- #process(_source, transformed, row_errors) ⇒ Object
Constructor Details
#initialize ⇒ CollectErrors
Returns a new instance of CollectErrors.
9 10 11 |
# File 'lib/csv_piper/processors/collect_errors.rb', line 9 def initialize @errors = {} end |
Instance Attribute Details
#errors ⇒ Object (readonly)
@return Holds all of the errors for each row that was processed { row_index => { errors_key => array_of_errors } }
8 9 10 |
# File 'lib/csv_piper/processors/collect_errors.rb', line 8 def errors @errors end |
Instance Method Details
#process(_source, transformed, row_errors) ⇒ Object
13 14 15 16 |
# File 'lib/csv_piper/processors/collect_errors.rb', line 13 def process(_source, transformed, row_errors) @errors[row_errors.row_index] = row_errors.errors unless row_errors.empty? [transformed, errors] end |