Class: ActiveSupport::Notifications::Fanout::Subscribers::Evented
- Inherits:
-
Object
- Object
- ActiveSupport::Notifications::Fanout::Subscribers::Evented
show all
- Defined in:
- 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.
140
141
142
143
144
|
# File 'lib/active_support/notifications/fanout.rb', line 140
def initialize(pattern, delegate)
@pattern = Matcher.wrap(pattern)
@delegate = delegate
@can_publish = delegate.respond_to?(:publish)
end
|
Instance Attribute Details
Returns the value of attribute pattern.
138
139
140
|
# File 'lib/active_support/notifications/fanout.rb', line 138
def pattern
@pattern
end
|
Instance Method Details
#finish(name, id, payload) ⇒ Object
156
157
158
|
# File 'lib/active_support/notifications/fanout.rb', line 156
def finish(name, id, payload)
@delegate.finish name, id, payload
end
|
#matches?(name) ⇒ Boolean
164
165
166
|
# File 'lib/active_support/notifications/fanout.rb', line 164
def matches?(name)
pattern && pattern === name
end
|
#publish(name, *args) ⇒ Object
146
147
148
149
150
|
# File 'lib/active_support/notifications/fanout.rb', line 146
def publish(name, *args)
if @can_publish
@delegate.publish name, *args
end
end
|
#start(name, id, payload) ⇒ Object
152
153
154
|
# File 'lib/active_support/notifications/fanout.rb', line 152
def start(name, id, payload)
@delegate.start name, id, payload
end
|
#subscribed_to?(name) ⇒ Boolean
160
161
162
|
# File 'lib/active_support/notifications/fanout.rb', line 160
def subscribed_to?(name)
pattern === name
end
|
#unsubscribe!(name) ⇒ Object
168
169
170
|
# File 'lib/active_support/notifications/fanout.rb', line 168
def unsubscribe!(name)
pattern.unsubscribe!(name)
end
|