Module: ActiveSupport::Notifications::Fanout::Subscribers
- Defined in:
- lib/active_support/notifications/fanout.rb
Overview
Defined Under Namespace
Classes: AllMessages, EventObject, Evented, Matcher, Timed
Class Method Summary
collapse
Class Method Details
.event_object_subscriber(pattern, block) ⇒ Object
106
107
108
|
# File 'lib/active_support/notifications/fanout.rb', line 106
def self.event_object_subscriber(pattern, block)
wrap_all pattern, EventObject.new(pattern, block)
end
|
.new(pattern, listener) ⇒ Object
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
|
# File 'lib/active_support/notifications/fanout.rb', line 87
def self.new(pattern, listener)
subscriber_class = Timed
if listener.respond_to?(:start) && listener.respond_to?(:finish)
subscriber_class = Evented
else
if listener.respond_to?(:parameters)
params = listener.parameters
if params.length == 1 && params.first.first == :opt
subscriber_class = EventObject
end
end
end
wrap_all pattern, subscriber_class.new(pattern, listener)
end
|
.wrap_all(pattern, subscriber) ⇒ Object
110
111
112
113
114
115
116
|
# File 'lib/active_support/notifications/fanout.rb', line 110
def self.wrap_all(pattern, subscriber)
unless pattern
AllMessages.new(subscriber)
else
subscriber
end
end
|