Class: CMDx::Pipeline
- Inherits:
-
Object
- Object
- CMDx::Pipeline
- Defined in:
- lib/cmdx/pipeline.rb
Overview
Executes workflows by processing task groups with conditional logic and breakpoint handling. The Pipeline class manages the execution flow of workflow tasks, evaluating conditions and handling breakpoints that can interrupt execution at specific task statuses.
Instance Attribute Summary collapse
-
#workflow ⇒ Workflow
readonly
Returns the workflow being executed by this pipeline.
Class Method Summary collapse
-
.execute(workflow) ⇒ void
Executes a workflow using a new pipeline instance.
Instance Method Summary collapse
-
#execute ⇒ void
Executes the workflow by processing all task groups in sequence.
-
#initialize(workflow) ⇒ Pipeline
constructor
A new pipeline instance.
Constructor Details
#initialize(workflow) ⇒ Pipeline
Returns A new pipeline instance.
27 28 29 |
# File 'lib/cmdx/pipeline.rb', line 27 def initialize(workflow) @workflow = workflow end |
Instance Attribute Details
#workflow ⇒ Workflow (readonly)
Returns the workflow being executed by this pipeline.
17 18 19 |
# File 'lib/cmdx/pipeline.rb', line 17 def workflow @workflow end |
Class Method Details
.execute(workflow) ⇒ void
This method returns an undefined value.
Executes a workflow using a new pipeline instance.
41 42 43 |
# File 'lib/cmdx/pipeline.rb', line 41 def self.execute(workflow) new(workflow).execute end |
Instance Method Details
#execute ⇒ void
This method returns an undefined value.
Executes the workflow by processing all task groups in sequence. Each group is evaluated against its conditions, and breakpoints are checked after each task execution to determine if workflow should continue or halt.
56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/cmdx/pipeline.rb', line 56 def execute workflow.class.pipeline.each do |group| next unless Utils::Condition.evaluate(workflow, group.) breakpoints = group.[:breakpoints] || workflow.class.settings[:breakpoints] || workflow.class.settings[:workflow_breakpoints] breakpoints = Array(breakpoints).map(&:to_s).uniq execute_group_tasks(group, breakpoints) end end |