Class: Wolflow::Cycle
Instance Attribute Summary
Attributes inherited from Simple
Attributes inherited from TaskSpec
#connects_to, #id, #name, #prev_tasks, #workflow_spec
Instance Method Summary collapse
- #connect(*specs) ⇒ Object
- #each_child(task) ⇒ Object
- #on_complete(task) ⇒ Object
- #to_hash_tree ⇒ Object
Methods inherited from Simple
#build_next_tasks, #choose, #connects_with, from_hash, #initialize, #inspect, #precedes?, #to_hash, #workflow_spec=
Methods inherited from TaskSpec
#child_of?, #each_ancestor, #each_parent, #each_successor, from_hash, inherited, #initialize
Constructor Details
This class inherits a constructor from Wolflow::Simple
Instance Method Details
#connect(*specs) ⇒ Object
5 6 7 8 9 10 11 12 13 |
# File 'lib/wolflow/cycle.rb', line 5 def connect(*specs) raise TaskSpecError, "cycles can only connect to a single task spec" unless specs.size == 1 spec = specs.first raise TaskSpecError, "cycles can only connect to previous task specs" unless child_of?(spec) super end |
#each_child(task) ⇒ Object
31 |
# File 'lib/wolflow/cycle.rb', line 31 def each_child(task); end |
#on_complete(task) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wolflow/cycle.rb', line 15 def on_complete(task) super task.children.each do |child_task| next if task == child_task reset_task(child_task) end task.reset! end |
#to_hash_tree ⇒ Object
27 28 29 |
# File 'lib/wolflow/cycle.rb', line 27 def to_hash_tree [to_hash] end |