Class: Novel::Executor::CompensationFlow

Inherits:
Object
  • Object
show all
Defined in:
lib/novel/executor/compensation_flow.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#containerObject (readonly)

Returns the value of attribute container.



6
7
8
# File 'lib/novel/executor/compensation_flow.rb', line 6

def container
  @container
end

#repositoryObject (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