Class: Bigrig::DependencyGraph
- Inherits:
-
Object
- Object
- Bigrig::DependencyGraph
- Defined in:
- lib/bigrig/dependency_graph.rb
Instance Method Summary collapse
-
#initialize(containers) ⇒ DependencyGraph
constructor
A new instance of DependencyGraph.
- #resolve ⇒ Object
- #resolve_subtree(container) ⇒ Object
Constructor Details
#initialize(containers) ⇒ DependencyGraph
Returns a new instance of DependencyGraph.
3 4 5 6 |
# File 'lib/bigrig/dependency_graph.rb', line 3 def initialize(containers) @containers = containers @map = containers.each_with_object({}) { |e, o| o[e.name] = e } end |
Instance Method Details
#resolve ⇒ Object
8 9 10 |
# File 'lib/bigrig/dependency_graph.rb', line 8 def resolve startup_order @containers end |
#resolve_subtree(container) ⇒ Object
12 13 14 15 |
# File 'lib/bigrig/dependency_graph.rb', line 12 def resolve_subtree(container) subtree = @containers.select { |c| resolve_deps(c, []).include? container.name } startup_order(subtree) & subtree end |