Class: DependencyManager::DependencyTree
- Inherits:
-
Delegator
- Object
- Delegator
- DependencyManager::DependencyTree
- 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
-
#resources ⇒ Object
(also: #__getobj__)
readonly
Returns the value of attribute resources.
Instance Method Summary collapse
-
#initialize(resources) ⇒ DependencyTree
constructor
A new instance of DependencyTree.
-
#tsort_each_child(node, &block) ⇒ Object
TSort interface method.
-
#tsort_each_node(&block) ⇒ Object
TSort interface method.
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
#resources ⇒ Object (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 |