Module: CMDx::Workflow

Defined in:
lib/cmdx/workflow.rb

Overview

Mixin that turns a Task subclass into a workflow: a pipeline of ordered task groups run sequentially or in parallel. Defining ‘#work` on a workflow is forbidden — `#work` is auto-generated to delegate to Pipeline. Subclasses inherit the parent’s pipeline (via dup).

See Also:

Defined Under Namespace

Modules: ClassMethods Classes: ExecutionGroup

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ void

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

This method returns an undefined value.

Parameters:

  • base (Class)

    task class including this mixin

Raises:



105
106
107
108
109
110
111
112
113
114
# File 'lib/cmdx/workflow.rb', line 105

def self.included(base)
  unless base.is_a?(Class) && base <= Task
    raise ImplementationError, <<~MSG.chomp
      CMDx::Workflow can only be included in a CMDx::Task subclass (got #{base.inspect}).
      See https://drexed.github.io/cmdx/workflows/#declarations
    MSG
  end

  base.extend(ClassMethods)
end

Instance Method Details

#workvoid

This method returns an undefined value.

Runs the workflow’s pipeline. Not meant to be overridden.



119
120
121
# File 'lib/cmdx/workflow.rb', line 119

def work
  Pipeline.execute(self)
end