module BatchProcessor::Batch::Processor
Constants
- PROCESSOR_CLASS_BY_STRATEGY
The default processors can be redefined and new custom ones can be added as well. rubocop:disable Style/MutableConstant
Public Instance Methods
inherited(base)
click to toggle source
Calls superclass method
# File lib/batch_processor/batch/processor.rb, line 44 def inherited(base) dup = _processor_options.dup base._processor_options = dup.each { |k, v| dup[k] = v.dup } super end
process(*arguments)
click to toggle source
# File lib/batch_processor/batch/processor.rb, line 30 def process(*arguments) new(*arguments).process end
process!(*arguments)
click to toggle source
# File lib/batch_processor/batch/processor.rb, line 34 def process!(*arguments) new(*arguments).process! end
processor_class()
click to toggle source
# File lib/batch_processor/batch/processor.rb, line 38 def processor_class return @processor_class if defined?(@processor_class) PROCESSOR_CLASS_BY_STRATEGY[:default] end
processor_option(option, value = nil)
click to toggle source
Certain processors have configurable options; this configuration is specified in the Batch's definition.
# File lib/batch_processor/batch/processor.rb, line 53 def processor_option(option, value = nil) _processor_options[option.to_sym] = value end
Private Instance Methods
handle_exception(exception)
click to toggle source
# File lib/batch_processor/batch/processor.rb, line 72 def handle_exception(exception) malfunction_class = exception.try(:conjugate, BatchProcessor::Malfunction::Base) error :process_error, exception: exception and return if malfunction_class.nil? if malfunction_class <= BatchProcessor::Malfunction::CollectionInvalid build_malfunction malfunction_class, collection else build_malfunction malfunction_class end end