class Wisper::TemporaryListeners
Public Class Methods
registrations()
click to toggle source
# File lib/wisper/temporary_listeners.rb, line 12 def self.registrations new.registrations end
subscribe(*listeners, &block)
click to toggle source
# File lib/wisper/temporary_listeners.rb, line 8 def self.subscribe(*listeners, &block) new.subscribe(*listeners, &block) end
Public Instance Methods
registrations()
click to toggle source
# File lib/wisper/temporary_listeners.rb, line 27 def registrations Thread.current[key] ||= Set.new end
subscribe(*listeners) { || ... }
click to toggle source
# File lib/wisper/temporary_listeners.rb, line 16 def subscribe(*listeners, &block) options = listeners.last.is_a?(Hash) ? listeners.pop : {} begin listeners.each { |listener| registrations << ObjectRegistration.new(listener, options) } yield ensure clear end self end
Private Instance Methods
clear()
click to toggle source
# File lib/wisper/temporary_listeners.rb, line 33 def clear registrations.clear end
key()
click to toggle source
# File lib/wisper/temporary_listeners.rb, line 37 def key '__wisper_temporary_listeners' end