Class: ActiveSupport::Notifications::Fanout::Subscriber
- Inherits:
-
Object
- Object
- ActiveSupport::Notifications::Fanout::Subscriber
- Defined in:
- lib/active_support/notifications/fanout.rb
Overview
:nodoc:
Instance Method Summary collapse
-
#initialize(pattern, delegate) ⇒ Subscriber
constructor
A new instance of Subscriber.
- #matches?(subscriber_or_name) ⇒ Boolean
- #publish(message, *args) ⇒ Object
- #subscribed_to?(name) ⇒ Boolean
Constructor Details
#initialize(pattern, delegate) ⇒ Subscriber
Returns a new instance of Subscriber.
40 41 42 43 |
# File 'lib/active_support/notifications/fanout.rb', line 40 def initialize(pattern, delegate) @pattern = pattern @delegate = delegate end |
Instance Method Details
#matches?(subscriber_or_name) ⇒ Boolean
53 54 55 56 |
# File 'lib/active_support/notifications/fanout.rb', line 53 def matches?(subscriber_or_name) self === subscriber_or_name || @pattern && @pattern === subscriber_or_name end |
#publish(message, *args) ⇒ Object
45 46 47 |
# File 'lib/active_support/notifications/fanout.rb', line 45 def publish(, *args) @delegate.call(, *args) end |
#subscribed_to?(name) ⇒ Boolean
49 50 51 |
# File 'lib/active_support/notifications/fanout.rb', line 49 def subscribed_to?(name) !@pattern || @pattern === name.to_s end |