Class: Wisper::TemporaryListeners Private
- Inherits:
-
Object
- Object
- Wisper::TemporaryListeners
- Defined in:
- lib/wisper/temporary_listeners.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Class Method Summary collapse
- .registrations ⇒ Object private
- .subscribe(*listeners, &block) ⇒ Object private
Instance Method Summary collapse
- #registrations ⇒ Object private
- #subscribe(*listeners, &block) ⇒ Object private
Class Method Details
.registrations ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
12 13 14 |
# File 'lib/wisper/temporary_listeners.rb', line 12 def self.registrations new.registrations end |
.subscribe(*listeners, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
8 9 10 |
# File 'lib/wisper/temporary_listeners.rb', line 8 def self.subscribe(*listeners, &block) new.subscribe(*listeners, &block) end |
Instance Method Details
#registrations ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
27 28 29 |
# File 'lib/wisper/temporary_listeners.rb', line 27 def registrations Thread.current[key] ||= Set.new end |
#subscribe(*listeners, &block) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/wisper/temporary_listeners.rb', line 16 def subscribe(*listeners, &block) = listeners.last.is_a?(Hash) ? listeners.pop : {} begin listeners.each { |listener| registrations << ObjectRegistration.new(listener, ) } yield ensure clear end self end |