Class: Processor::Runner

Inherits:
Object
  • Object
show all
Defined in:
lib/processor/runner.rb

Instance Method Summary collapse

Constructor Details

#initialize(processor, events_registrator) ⇒ Runner

Returns a new instance of Runner.



5
6
7
8
# File 'lib/processor/runner.rb', line 5

def initialize(processor, events_registrator)
  @processor = processor
  @events = events_registrator
end

Instance Method Details

#run(process_runner) ⇒ Object



10
11
12
13
14
15
16
17
18
19
# File 'lib/processor/runner.rb', line 10

def run(process_runner)
  events.register :processing_started, processor

  process_runner.call processor, events, method(:recursion_preventer)

  events.register :processing_finished, processor
rescue Exception => exception
  events.register :processing_error, processor, exception
  raise exception
end