Class: DevSuite::Workflow::Step::Base

Inherits:
Utils::Construct::Component::Base show all
Defined in:
lib/dev_suite/workflow/step/base.rb

Direct Known Subclasses

Composite, Conditional, Loop, Parallel

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Utils::Construct::Component::Base

component_key

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

#nameObject

Returns the value of attribute name.



7
8
9
# File 'lib/dev_suite/workflow/step/base.rb', line 7

def name
  @name
end

#next_stepObject

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