Module: ARake::Misc
- Defined in:
- lib/arake.rb
Defined Under Namespace
Classes: Tree
Class Method Summary collapse
-
.pt_table_from_tasks(tasks) ⇒ Object
prerequisite-to-target table.
- .root_tasks_of(task, tasks) ⇒ Object
- .tree_from_task(task, table = Hash.new {|h, key| h[key] = []}) ⇒ Object
Class Method Details
.pt_table_from_tasks(tasks) ⇒ Object
prerequisite-to-target table
109 110 111 112 113 114 115 116 117 |
# File 'lib/arake.rb', line 109 def self.pt_table_from_tasks(tasks) # prerequisite-to-target table h = Hash.new {|h, name| h[name] = []} tasks.each do |target_task| target_task.prerequisites.each do |prerequisite| h[prerequisite.to_s].push target_task end end h end |
.root_tasks_of(task, tasks) ⇒ Object
105 106 107 |
# File 'lib/arake.rb', line 105 def self.root_tasks_of(task, tasks) tree_from_task(task, pt_table_from_tasks(tasks)).leaves end |