Class: CircuitBreaker::Executors::StepExecutor
- Inherits:
-
BaseExecutor
- Object
- BaseExecutor
- CircuitBreaker::Executors::StepExecutor
- Defined in:
- lib/circuit_breaker/executors/step_executor.rb
Instance Attribute Summary
Attributes inherited from BaseExecutor
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(context = {}) ⇒ StepExecutor
constructor
A new instance of StepExecutor.
Methods included from DSL
included, #validate_parameters
Constructor Details
#initialize(context = {}) ⇒ StepExecutor
Returns a new instance of StepExecutor.
6 7 8 9 10 |
# File 'lib/circuit_breaker/executors/step_executor.rb', line 6 def initialize(context = {}) super @steps = context[:steps] || [] @parallel = context[:parallel] || false end |
Instance Method Details
#execute ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/circuit_breaker/executors/step_executor.rb', line 12 def execute results = if @parallel execute_parallel else execute_sequential end @result = { steps: results, status: 'completed' } end |