Class: Novel::Executor::ActivityFlow
- Inherits:
-
Object
- Object
- Novel::Executor::ActivityFlow
- Defined in:
- lib/novel/executor/activity_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:) ⇒ ActivityFlow
constructor
A new instance of ActivityFlow.
Constructor Details
#initialize(container:, repository:) ⇒ ActivityFlow
Returns a new instance of ActivityFlow.
8 9 10 11 |
# File 'lib/novel/executor/activity_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/activity_flow.rb', line 6 def container @container end |
#repository ⇒ Object (readonly)
Returns the value of attribute repository.
6 7 8 |
# File 'lib/novel/executor/activity_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/activity_flow.rb', line 13 def call(context, state_machine, steps) steps.each_with_index do |step, index| result = execut_step(context, state_machine, step, steps[index + 1]) return result if result.failure? || result.value![:status] == :waiting context = result.value![:context] result end Success(status: :finished, context: context) end |