Module: ActiveSupport::Notifications::Fanout::Subscribers
- Defined in:
- activesupport/lib/active_support/notifications/fanout.rb
Overview
Defined Under Namespace
Classes: AllMessages, EventObject, Evented, Matcher, MonotonicTimed, Timed
Class Method Summary
collapse
Class Method Details
.event_object_subscriber(pattern, block) ⇒ Object
107
108
109
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 107
def self.event_object_subscriber(pattern, block)
wrap_all pattern, EventObject.new(pattern, block)
end
|
.new(pattern, listener, monotonic) ⇒ Object
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 88
def self.new(pattern, listener, monotonic)
subscriber_class = monotonic ? MonotonicTimed : 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
111
112
113
114
115
116
117
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 111
def self.wrap_all(pattern, subscriber)
unless pattern
AllMessages.new(subscriber)
else
subscriber
end
end
|