class Cukedep::FeatureModel::DepGraph
Helper class used internally by FeatureModel
class. Purpose: to try to create a valid dependency graph and perform a topological sort of the nodes.
Attributes
dependencies[R]
lookup[R]
Inverse lookup: from the feature file => FeatureDependencies
Public Class Methods
new(theDependencies)
click to toggle source
# File lib/cukedep/feature-model.rb, line 27 def initialize(theDependencies) @dependencies = theDependencies @lookup = dependencies.each_with_object({}) do |f_deps, subresult| subresult[f_deps.dependee] = f_deps end end
Public Instance Methods
tsort_each_child(aDependency, &aBlock)
click to toggle source
Method required by TSort module. It is used to iterate over all the children nodes of the given node.
# File lib/cukedep/feature-model.rb, line 42 def tsort_each_child(aDependency, &aBlock) dependents = aDependency.dependents children = dependents.map { |feature| lookup[feature] } children.each(&aBlock) end
tsort_each_node(&aBlock)
click to toggle source
Method required by TSort module. It is used to iterate over all the nodes of the dependency graph
# File lib/cukedep/feature-model.rb, line 36 def tsort_each_node(&aBlock) return dependencies.each(&aBlock) end