Module: CMDx::Workflow::ClassMethods
- Defined in:
- lib/cmdx/workflow.rb
Instance Method Summary collapse
-
#method_added(method_name) ⇒ Object
Prevents redefinition of the work method to maintain workflow integrity.
-
#pipeline ⇒ Array<ExecutionGroup>
Returns the collection of execution groups for this workflow.
-
#tasks(*tasks, **options) ⇒ Object
(also: #task)
Adds multiple tasks to the workflow with optional configuration.
Instance Method Details
#method_added(method_name) ⇒ Object
Prevents redefinition of the work method to maintain workflow integrity.
25 26 27 28 29 |
# File 'lib/cmdx/workflow.rb', line 25 def method_added(method_name) raise "cannot redefine #{name}##{method_name} method" if method_name == :work super end |
#pipeline ⇒ Array<ExecutionGroup>
Returns the collection of execution groups for this workflow.
44 45 46 |
# File 'lib/cmdx/workflow.rb', line 44 def pipeline @pipeline ||= [] end |
#tasks(*tasks, **options) ⇒ Object Also known as: task
Adds multiple tasks to the workflow with optional configuration.
64 65 66 67 68 69 70 71 72 73 |
# File 'lib/cmdx/workflow.rb', line 64 def tasks(*tasks, **) pipeline << ExecutionGroup.new( tasks.map do |task| next task if task.is_a?(Class) && (task <= Task) raise TypeError, "must be a CMDx::Task" end, ) end |