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