diff options
-rw-r--r-- | activesupport/lib/active_support/notifications/fanout.rb | 18 |
1 files changed, 4 insertions, 14 deletions
diff --git a/activesupport/lib/active_support/notifications/fanout.rb b/activesupport/lib/active_support/notifications/fanout.rb index b27713e4ad..fa469c8b79 100644 --- a/activesupport/lib/active_support/notifications/fanout.rb +++ b/activesupport/lib/active_support/notifications/fanout.rb @@ -6,13 +6,15 @@ module ActiveSupport def initialize @subscribers = [] @listeners_for = {} + @pattern = nil end def bind(pattern) - Binding.new(self, pattern) + @pattern = pattern + self end - def subscribe(pattern = nil, &block) + def subscribe(pattern = @pattern, &block) @listeners_for.clear @subscribers << Subscriber.new(pattern, &block) @subscribers.last @@ -35,18 +37,6 @@ module ActiveSupport def wait end - # Used for internal implementation only. - class Binding #:nodoc: - def initialize(queue, pattern) - @queue = queue - @pattern = pattern - end - - def subscribe(&block) - @queue.subscribe(@pattern, &block) - end - end - class Subscriber #:nodoc: def initialize(pattern, &block) @pattern = pattern |