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.
35 36 37 |
# File 'lib/cmdx/pipeline.rb', line 35 def initialize(workflow) @workflow = workflow end |
Instance Attribute Details
#workflow ⇒ Workflow (readonly)
Returns the workflow being executed by this pipeline.
25 26 27 |
# File 'lib/cmdx/pipeline.rb', line 25 def workflow @workflow end |
Class Method Details
.execute(workflow) ⇒ void
This method returns an undefined value.
Executes a workflow using a new pipeline instance.
49 50 51 |
# File 'lib/cmdx/pipeline.rb', line 49 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.
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 |
# File 'lib/cmdx/pipeline.rb', line 64 def execute default_breakpoints = Utils::Normalize.statuses( workflow.class.settings.breakpoints || workflow.class.settings.workflow_breakpoints ) workflow.class.pipeline.each do |group| next unless Utils::Condition.evaluate(workflow, group.) breakpoints = if group..key?(:breakpoints) Utils::Normalize.statuses(group.[:breakpoints]) else default_breakpoints end execute_group_tasks(group, breakpoints) end end |