Module: Philiprehberger::CsvKit::ErrorHandler
- Included in:
- Processor
- Defined in:
- lib/philiprehberger/csv_kit/error_handler.rb
Overview
Mixin for per-row error handling and max-error tracking.
Instance Method Summary collapse
-
#errors ⇒ Array<Hash>
Returns collected errors from the last run.
-
#max_errors(limit) ⇒ self
Set a maximum number of errors before aborting.
-
#on_error {|Hash, StandardError| ... } ⇒ Object
Configure a per-row error handler.
Instance Method Details
#errors ⇒ Array<Hash>
Returns collected errors from the last run.
27 28 29 |
# File 'lib/philiprehberger/csv_kit/error_handler.rb', line 27 def errors @errors ||= [] end |
#max_errors(limit) ⇒ self
Set a maximum number of errors before aborting.
19 20 21 22 |
# File 'lib/philiprehberger/csv_kit/error_handler.rb', line 19 def max_errors(limit) @max_errors = limit self end |
#on_error {|Hash, StandardError| ... } ⇒ Object
Configure a per-row error handler.
11 12 13 |
# File 'lib/philiprehberger/csv_kit/error_handler.rb', line 11 def on_error(&block) @error_handler = block end |