Class: ActiveSupport::Notifications::Fanout::Subscribers::Evented
- Defined in:
- lib/active_support/notifications/fanout.rb
Overview
:nodoc:
Direct Known Subclasses
Instance Method Summary collapse
- #finish(name, id, payload) ⇒ Object
-
#initialize(pattern, delegate) ⇒ Evented
constructor
A new instance of Evented.
- #matches?(subscriber_or_name) ⇒ Boolean
- #publish(name, *args) ⇒ Object
- #start(name, id, payload) ⇒ Object
- #subscribed_to?(name) ⇒ Boolean
Constructor Details
#initialize(pattern, delegate) ⇒ Evented
Returns a new instance of Evented.
79 80 81 82 83 |
# File 'lib/active_support/notifications/fanout.rb', line 79 def initialize(pattern, delegate) @pattern = pattern @delegate = delegate @can_publish = delegate.respond_to?(:publish) end |
Instance Method Details
#finish(name, id, payload) ⇒ Object
95 96 97 |
# File 'lib/active_support/notifications/fanout.rb', line 95 def finish(name, id, payload) @delegate.finish name, id, payload end |
#matches?(subscriber_or_name) ⇒ Boolean
103 104 105 106 |
# File 'lib/active_support/notifications/fanout.rb', line 103 def matches?(subscriber_or_name) self === subscriber_or_name || @pattern && @pattern === subscriber_or_name end |
#publish(name, *args) ⇒ Object
85 86 87 88 89 |
# File 'lib/active_support/notifications/fanout.rb', line 85 def publish(name, *args) if @can_publish @delegate.publish name, *args end end |
#start(name, id, payload) ⇒ Object
91 92 93 |
# File 'lib/active_support/notifications/fanout.rb', line 91 def start(name, id, payload) @delegate.start name, id, payload end |
#subscribed_to?(name) ⇒ Boolean
99 100 101 |
# File 'lib/active_support/notifications/fanout.rb', line 99 def subscribed_to?(name) @pattern === name.to_s end |