Class: Wisper::TemporaryListeners
- Inherits:
-
Object
- Object
- Wisper::TemporaryListeners
- Defined in:
- lib/wisper/temporary_listeners.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.registrations ⇒ Object
9 10 11 |
# File 'lib/wisper/temporary_listeners.rb', line 9 def self.registrations new.registrations end |
.with(*listeners, &block) ⇒ Object
4 5 6 7 |
# File 'lib/wisper/temporary_listeners.rb', line 4 def self.with(*listeners, &block) = listeners.last.is_a?(Hash) ? listeners.pop : {} new.with(listeners, , &block) end |
Instance Method Details
#registrations ⇒ Object
19 20 21 |
# File 'lib/wisper/temporary_listeners.rb', line 19 def registrations Thread.current[key] ||= Set.new end |
#with(listeners, options, &block) ⇒ Object
13 14 15 16 17 |
# File 'lib/wisper/temporary_listeners.rb', line 13 def with(listeners, , &block) add_listeners(listeners, ) yield clear end |