diff options
author | Luke Kanies <luke@madstop.com> | 2008-11-06 14:25:37 -0600 |
---|---|---|
committer | Luke Kanies <luke@madstop.com> | 2008-11-06 14:25:37 -0600 |
commit | a73cad9c8fabb8314e87753a3f73cf96fd4dc560 (patch) | |
tree | e08a12737baeee842a7b91153f72f2436a533382 /lib/puppet | |
parent | 2a685f9194c5eb98b67f9759a90a8a193983c467 (diff) | |
download | puppet-a73cad9c8fabb8314e87753a3f73cf96fd4dc560.tar.gz puppet-a73cad9c8fabb8314e87753a3f73cf96fd4dc560.tar.xz puppet-a73cad9c8fabb8314e87753a3f73cf96fd4dc560.zip |
Adding SimpleGraph#leaves, which I apparently did not migrate from PGraph
Signed-off-by: Luke Kanies <luke@madstop.com>
Diffstat (limited to 'lib/puppet')
-rw-r--r-- | lib/puppet/simple_graph.rb | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 73a6bdfed..c6afa4b68 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -116,6 +116,13 @@ class Puppet::SimpleGraph def directed? true end + + # Determine all of the leaf nodes below a given vertex. + def leaves(vertex, direction = :out) + tree = tree_from_vertex(vertex, direction) + l = tree.keys.find_all { |c| adjacent(c, :direction => direction).empty? } + return l + end # Collect all of the edges that the passed events match. Returns # an array of edges. |