Class: Novel::Executor::CompensationFlow
- Inherits:
-
Object
- Object
- Novel::Executor::CompensationFlow
- Defined in:
- lib/novel/executor/compensation_flow.rb
Instance Attribute Summary collapse
-
#container ⇒ Object
readonly
Returns the value of attribute container.
-
#repository ⇒ Object
readonly
Returns the value of attribute repository.
Instance Method Summary collapse
- #call(context, state_machine, steps) ⇒ Object
-
#initialize(container:, repository:) ⇒ CompensationFlow
constructor
A new instance of CompensationFlow.
Constructor Details
#initialize(container:, repository:) ⇒ CompensationFlow
Returns a new instance of CompensationFlow.
8 9 10 11 |
# File 'lib/novel/executor/compensation_flow.rb', line 8 def initialize(container:, repository:) @container = container @repository = repository end |
Instance Attribute Details
#container ⇒ Object (readonly)
Returns the value of attribute container.
6 7 8 |
# File 'lib/novel/executor/compensation_flow.rb', line 6 def container @container end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
6 7 8 |
# File 'lib/novel/executor/compensation_flow.rb', line 6 def repository @repository end |
Instance Method Details
#call(context, state_machine, steps) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/novel/executor/compensation_flow.rb', line 13 def call(context, state_machine, steps) steps.each_with_index.map do |step, index| result = execut_step(context, state_machine, step, steps[index + 1]) context = result.value![:context] if result.value![:status] == :waiting return result else result end end end |