Class: ActiveSupport::Notifications::Fanout::Subscribers::Evented
- Inherits:
-
Object
- Object
- ActiveSupport::Notifications::Fanout::Subscribers::Evented
show all
- Defined in:
- activesupport/lib/active_support/notifications/fanout.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(pattern, delegate) ⇒ Evented
Returns a new instance of Evented.
190
191
192
193
194
195
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 190
def initialize(pattern, delegate)
@pattern = Matcher.wrap(pattern)
@delegate = delegate
@can_publish = delegate.respond_to?(:publish)
@can_publish_event = delegate.respond_to?(:publish_event)
end
|
Instance Attribute Details
Returns the value of attribute pattern.
188
189
190
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 188
def pattern
@pattern
end
|
Instance Method Details
#finish(name, id, payload) ⇒ Object
215
216
217
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 215
def finish(name, id, payload)
@delegate.finish name, id, payload
end
|
#publish(name, *args) ⇒ Object
197
198
199
200
201
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 197
def publish(name, *args)
if @can_publish
@delegate.publish name, *args
end
end
|
#publish_event(event) ⇒ Object
203
204
205
206
207
208
209
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 203
def publish_event(event)
if @can_publish_event
@delegate.publish_event event
else
publish(event.name, event.time, event.end, event.transaction_id, event.payload)
end
end
|
#start(name, id, payload) ⇒ Object
211
212
213
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 211
def start(name, id, payload)
@delegate.start name, id, payload
end
|
#subscribed_to?(name) ⇒ Boolean
219
220
221
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 219
def subscribed_to?(name)
pattern === name
end
|
#unsubscribe!(name) ⇒ Object
223
224
225
|
# File 'activesupport/lib/active_support/notifications/fanout.rb', line 223
def unsubscribe!(name)
pattern.unsubscribe!(name)
end
|