lib/arborist/manager.rb in arborist-0.0.1.pre20160829140603 vs lib/arborist/manager.rb in arborist-0.0.1.pre20161005112841

- old
+ new

@@ -62,13 +62,11 @@ singleton_attr_accessor :linger ### Configurability API -- configure the manager def self::configure( config=nil ) - config ||= {} - config = self.defaults.merge( config[:manager] || {} ) - + config = self.defaults.merge( config || {} ) self.log.debug "Config is: %p" % [ config ] self.state_file = config[:state_file] && Pathname( config[:state_file] ) self.linger = config[:linger].to_i self.log.info "Linger configured to %p" % [ self.linger ] @@ -729,12 +727,12 @@ ### Create a subscription that publishes to the Manager's event publisher for ### the node with the specified +identifier+ and +event_pattern+, using the ### given +criteria+ when considering an event. - def create_subscription( identifier, event_pattern, criteria ) - sub = Arborist::Subscription.new( event_pattern, criteria ) do |*args| + def create_subscription( identifier, event_pattern, criteria, negative_criteria={} ) + sub = Arborist::Subscription.new( event_pattern, criteria, negative_criteria ) do |*args| self.event_publisher.publish( *args ) end self.subscribe( identifier, sub ) return sub @@ -753,9 +751,14 @@ ### publishing them to matching subscriptions belonging to the nodes along the way. def propagate_events( node, *events ) node.publish_events( *events ) if node.parent + self.log.debug "Propagating %d events from %s -> %s" % [ + events.length, + node.identifier, + node.parent + ] parent = self.nodes[ node.parent ] or raise "couldn't find parent %p of node %p!" % [ node.parent, node.identifier ] self.propagate_events( parent, *events ) end end