From 329527f5173d17c9c2b788734033534009efcf04 Mon Sep 17 00:00:00 2001 From: Luke Kanies Date: Sun, 1 Nov 2009 13:16:39 -0600 Subject: Changing SimpleGraph.matching_edges to expect one event It previously worked with multiple, but the only caller actually only ever passed one event. Signed-off-by: Luke Kanies --- lib/puppet/simple_graph.rb | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) (limited to 'lib/puppet') diff --git a/lib/puppet/simple_graph.rb b/lib/puppet/simple_graph.rb index 5e8f5cdb7..91603945c 100644 --- a/lib/puppet/simple_graph.rb +++ b/lib/puppet/simple_graph.rb @@ -145,21 +145,19 @@ class Puppet::SimpleGraph # Collect all of the edges that the passed events match. Returns # an array of edges. - def matching_edges(events, base = nil) - events.collect do |event| - source = base || event.source + def matching_edges(event, base = nil) + source = base || event.resource - unless vertex?(source) - Puppet.warning "Got an event from invalid vertex %s" % source.ref - next - end - # Get all of the edges that this vertex should forward events - # to, which is the same thing as saying all edges directly below - # This vertex in the graph. - adjacent(source, :direction => :out, :type => :edges).find_all do |edge| - edge.match?(event.name) - end - end.compact.flatten + unless vertex?(source) + Puppet.warning "Got an event from invalid vertex #{source.ref}" + return [] + end + # Get all of the edges that this vertex should forward events + # to, which is the same thing as saying all edges directly below + # This vertex in the graph. + adjacent(source, :direction => :out, :type => :edges).find_all do |edge| + edge.match?(event.name) + end end # Return a reversed version of this graph. -- cgit