Class: DevSuite::Workflow::Step::Base
- Inherits:
-
Utils::Construct::Component::Base
- Object
- Utils::Construct::Component::Base
- DevSuite::Workflow::Step::Base
- Defined in:
- lib/dev_suite/workflow/step/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#next_step ⇒ Object
Returns the value of attribute next_step.
Instance Method Summary collapse
-
#initialize(name:, &action) ⇒ Base
constructor
A new instance of Base.
-
#next(step) ⇒ Object
Chain the next step.
-
#run(context) ⇒ Object
Executes the step and moves to the next step.
Methods inherited from Utils::Construct::Component::Base
Constructor Details
#initialize(name:, &action) ⇒ Base
Returns a new instance of Base.
9 10 11 12 13 14 |
# File 'lib/dev_suite/workflow/step/base.rb', line 9 def initialize(name:, &action) super() @name = name @action = action @next_step = nil end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
7 8 9 |
# File 'lib/dev_suite/workflow/step/base.rb', line 7 def name @name end |
#next_step ⇒ Object
Returns the value of attribute next_step.
7 8 9 |
# File 'lib/dev_suite/workflow/step/base.rb', line 7 def next_step @next_step end |
Instance Method Details
#next(step) ⇒ Object
Chain the next step
29 30 31 32 |
# File 'lib/dev_suite/workflow/step/base.rb', line 29 def next(step) @next_step = step step end |
#run(context) ⇒ Object
Executes the step and moves to the next step
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/dev_suite/workflow/step/base.rb', line 17 def run(context) result = perform_action(context) Utils::Logger.log("Step: #{@name} - Result: #{result}", level: :info) # If the result is nil or false, stop execution chain return unless result update_context(context, result) run_next_step(context) end |