summaryrefslogtreecommitdiffstats
path: root/lib/puppet/util/graph.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/puppet/util/graph.rb')
-rw-r--r--lib/puppet/util/graph.rb32
1 files changed, 16 insertions, 16 deletions
diff --git a/lib/puppet/util/graph.rb b/lib/puppet/util/graph.rb
index 5dd55e951..9598d281e 100644
--- a/lib/puppet/util/graph.rb
+++ b/lib/puppet/util/graph.rb
@@ -6,25 +6,25 @@ require 'puppet/simple_graph'
# A module that handles the small amount of graph stuff in Puppet.
module Puppet::Util::Graph
- # Make a graph where each of our children gets converted to
- # the receiving end of an edge. Call the same thing on all
- # of our children, optionally using a block
- def to_graph(graph = nil, &block)
- # Allow our calling function to send in a graph, so that we
- # can call this recursively with one graph.
- graph ||= Puppet::SimpleGraph.new
+ # Make a graph where each of our children gets converted to
+ # the receiving end of an edge. Call the same thing on all
+ # of our children, optionally using a block
+ def to_graph(graph = nil, &block)
+ # Allow our calling function to send in a graph, so that we
+ # can call this recursively with one graph.
+ graph ||= Puppet::SimpleGraph.new
- self.each do |child|
- unless block_given? and ! yield(child)
- graph.add_edge(self, child)
+ self.each do |child|
+ unless block_given? and ! yield(child)
+ graph.add_edge(self, child)
- child.to_graph(graph, &block) if child.respond_to?(:to_graph)
- end
- end
+ child.to_graph(graph, &block) if child.respond_to?(:to_graph)
+ end
+ end
- # Do a topsort, which will throw an exception if the graph is cyclic.
+ # Do a topsort, which will throw an exception if the graph is cyclic.
- graph
- end
+ graph
+ end
end