Parent

Class Index [+]

Quicksearch

ActiveSupport::Notifications::Fanout

This is a default queue implementation that ships with Notifications. It just pushes events to all registered log subscribers.

Public Class Methods

new() click to toggle source
   # File lib/active_support/notifications/fanout.rb, line 6
6:       def initialize
7:         @subscribers = []
8:         @listeners_for = {}
9:       end

Public Instance Methods

listeners_for(name) click to toggle source
    # File lib/active_support/notifications/fanout.rb, line 28
28:       def listeners_for(name)
29:         @listeners_for[name] ||= @subscribers.select { |s| s.subscribed_to?(name) }
30:       end
listening?(name) click to toggle source
    # File lib/active_support/notifications/fanout.rb, line 32
32:       def listening?(name)
33:         listeners_for(name).any?
34:       end
publish(name, *args) click to toggle source
    # File lib/active_support/notifications/fanout.rb, line 24
24:       def publish(name, *args)
25:         listeners_for(name).each { |s| s.publish(name, *args) }
26:       end
subscribe(pattern = nil, block = Proc.new) click to toggle source
    # File lib/active_support/notifications/fanout.rb, line 11
11:       def subscribe(pattern = nil, block = Proc.new)
12:         subscriber = Subscriber.new(pattern, block).tap do |s|
13:           @subscribers << s
14:         end
15:         @listeners_for.clear
16:         subscriber
17:       end
unsubscribe(subscriber) click to toggle source
    # File lib/active_support/notifications/fanout.rb, line 19
19:       def unsubscribe(subscriber)
20:         @subscribers.reject! {|s| s.matches?(subscriber)}
21:         @listeners_for.clear
22:       end
wait() click to toggle source

This is a sync queue, so there is not waiting.

    # File lib/active_support/notifications/fanout.rb, line 37
37:       def wait
38:       end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.