Class: CronoTrigger::ExecutionTracker
- Inherits:
-
Object
- Object
- CronoTrigger::ExecutionTracker
- Defined in:
- lib/crono_trigger/execution_tracker.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(schedulable) ⇒ ExecutionTracker
constructor
A new instance of ExecutionTracker.
- #track(&pr) ⇒ Object
Constructor Details
#initialize(schedulable) ⇒ ExecutionTracker
Returns a new instance of ExecutionTracker.
3 4 5 |
# File 'lib/crono_trigger/execution_tracker.rb', line 3 def initialize(schedulable) @schedulable = schedulable end |
Class Method Details
.track(schedulable, &pr) ⇒ Object
7 8 9 |
# File 'lib/crono_trigger/execution_tracker.rb', line 7 def self.track(schedulable, &pr) new(schedulable).track(&pr) end |
Instance Method Details
#track(&pr) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/crono_trigger/execution_tracker.rb', line 11 def track(&pr) if @schedulable.track_execution begin execution = @schedulable.crono_trigger_executions. result = pr.call case result when :ok execution.complete! when :retry execution. when :abort execution.aborted! else execution.complete! end rescue => e execution.error!(e) raise end else pr.call end end |