Permalink
Browse files

evented subscribers work

  • Loading branch information...
1 parent f08f875 commit 6989db9238446838448d8974f6e0934161bd95b9 @tenderlove tenderlove committed Mar 21, 2012
Showing with 10 additions and 6 deletions.
  1. +10 −6 activesupport/lib/active_support/notifications/fanout.rb
@@ -45,11 +45,15 @@ def wait
end
module Subscribers # :nodoc:
- def self.new(pattern, block)
- if pattern
- TimedSubscriber.new pattern, block
+ def self.new(pattern, listener)
+ if listener.respond_to?(:call)
+ if pattern
+ TimedSubscriber.new pattern, listener
+ else
+ AllMessages.new pattern, listener
+ end
else
- AllMessages.new pattern, block
+ Subscriber.new pattern, listener
end
end
@@ -60,11 +64,11 @@ def initialize(pattern, delegate)
end
def start(name, id, payload)
- raise NotImplementedError
+ @delegate.start name, id, payload
end
def finish(name, id, payload)
- raise NotImplementedError
+ @delegate.finish name, id, payload
end
def subscribed_to?(name)

0 comments on commit 6989db9

Please sign in to comment.