Class: DecisionAgent::Simulation::ShadowTestEngine::ProgressTracker
- Inherits:
-
Object
- Object
- DecisionAgent::Simulation::ShadowTestEngine::ProgressTracker
- Defined in:
- lib/decision_agent/simulation/shadow_test_engine.rb
Overview
Helper class for tracking progress
Instance Method Summary collapse
- #increment ⇒ Object
-
#initialize(total, callback) ⇒ ProgressTracker
constructor
A new instance of ProgressTracker.
Constructor Details
#initialize(total, callback) ⇒ ProgressTracker
Returns a new instance of ProgressTracker.
130 131 132 133 134 |
# File 'lib/decision_agent/simulation/shadow_test_engine.rb', line 130 def initialize(total, callback) @total = total @callback = callback @completed = 0 end |
Instance Method Details
#increment ⇒ Object
136 137 138 139 140 141 142 143 144 145 |
# File 'lib/decision_agent/simulation/shadow_test_engine.rb', line 136 def increment @completed += 1 return unless @callback @callback.call( completed: @completed, total: @total, percentage: (@completed.to_f / @total * 100).round(2) ) end |