Class: WorkflowRb::OutcomeBuilder
- Inherits:
-
Object
- Object
- WorkflowRb::OutcomeBuilder
- Defined in:
- lib/workflow_rb/services/workflow_builder.rb
Instance Attribute Summary collapse
-
#outcome ⇒ Object
Returns the value of attribute outcome.
Instance Method Summary collapse
-
#initialize(workflow_builder, outcome) ⇒ OutcomeBuilder
constructor
A new instance of OutcomeBuilder.
- #then(body, &setup) ⇒ Object
- #then_step(&body) ⇒ Object
Constructor Details
#initialize(workflow_builder, outcome) ⇒ OutcomeBuilder
Returns a new instance of OutcomeBuilder.
144 145 146 147 |
# File 'lib/workflow_rb/services/workflow_builder.rb', line 144 def initialize(workflow_builder, outcome) @workflow_builder = workflow_builder @outcome = outcome end |
Instance Attribute Details
#outcome ⇒ Object
Returns the value of attribute outcome.
142 143 144 |
# File 'lib/workflow_rb/services/workflow_builder.rb', line 142 def outcome @outcome end |
Instance Method Details
#then(body, &setup) ⇒ Object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/workflow_rb/services/workflow_builder.rb', line 149 def then(body, &setup) new_step = WorkflowStep.new new_step.body = body @workflow_builder.add_step(new_step) new_builder = StepBuilder.new(@workflow_builder, new_step) if setup setup.call(new_builder) end @outcome.next_step = new_step.id new_builder end |
#then_step(&body) ⇒ Object
164 165 166 |
# File 'lib/workflow_rb/services/workflow_builder.rb', line 164 def then_step(&body) self.then(body) end |