Class: Pallets::Workflow
- Inherits:
-
Object
- Object
- Pallets::Workflow
- Extended by:
- DSL::Workflow
- Defined in:
- lib/pallets/workflow.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
Class Method Summary collapse
Instance Method Summary collapse
- #id ⇒ Object
-
#initialize(context_hash = {}) ⇒ Workflow
constructor
A new instance of Workflow.
- #run ⇒ Object
Methods included from DSL::Workflow
Constructor Details
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
5 6 7 |
# File 'lib/pallets/workflow.rb', line 5 def context @context end |
Class Method Details
.build(&block) ⇒ Object
7 8 9 10 11 |
# File 'lib/pallets/workflow.rb', line 7 def self.build(&block) Class.new(self).tap do |workflow_class| workflow_class.instance_eval(&block) end end |
Instance Method Details
#id ⇒ Object
27 28 29 |
# File 'lib/pallets/workflow.rb', line 27 def id @id ||= "P#{Pallets::Util.generate_id(self.class.name)}".upcase end |
#run ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/pallets/workflow.rb', line 19 def run raise WorkflowError, "#{self.class.name} has no tasks. Workflows "\ "must contain at least one task" if self.class.graph.empty? backend.run_workflow(id, *prepare_jobs, serializer.dump_context(context.buffer)) id end |