Class: DependencyManager::DependencyTree

Inherits:
Delegator
  • Object
show all
Includes:
TSort
Defined in:
lib/dependency_manager/dependency_tree.rb

Overview

Dependency tree implementation using TSort to resolve the order in which factories should be run.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resources) ⇒ DependencyTree

Returns a new instance of DependencyTree.



15
16
17
# File 'lib/dependency_manager/dependency_tree.rb', line 15

def initialize(resources)
  @resources = resources
end

Instance Attribute Details

#resourcesObject (readonly) Also known as: __getobj__

Returns the value of attribute resources.



10
11
12
# File 'lib/dependency_manager/dependency_tree.rb', line 10

def resources
  @resources
end

Instance Method Details

#tsort_each_child(node, &block) ⇒ Object

TSort interface method



25
26
27
# File 'lib/dependency_manager/dependency_tree.rb', line 25

def tsort_each_child(node, &block)
  @resources.fetch(node).each(&block)
end

#tsort_each_node(&block) ⇒ Object

TSort interface method



20
21
22
# File 'lib/dependency_manager/dependency_tree.rb', line 20

def tsort_each_node(&block)
  @resources.each_key(&block)
end