Class: RSMP::Listener
- Inherits:
-
Object
- Object
- RSMP::Listener
- Includes:
- Inspect
- Defined in:
- lib/rsmp/collect/listener.rb
Direct Known Subclasses
Instance Method Summary collapse
- #change_notifier(notifier) ⇒ Object
-
#initialize(notifier, options = {}) ⇒ Listener
constructor
A new instance of Listener.
- #listen(&block) ⇒ Object
- #notify(message) ⇒ Object
- #notify_error(error, options = {}) ⇒ Object
Methods included from Inspect
Constructor Details
#initialize(notifier, options = {}) ⇒ Listener
Returns a new instance of Listener.
8 9 10 |
# File 'lib/rsmp/collect/listener.rb', line 8 def initialize notifier, ={} @notifier = notifier end |
Instance Method Details
#change_notifier(notifier) ⇒ Object
12 13 14 15 |
# File 'lib/rsmp/collect/listener.rb', line 12 def change_notifier notifier @notifier.remove_listener self if @notifier @notifier = notifier end |
#listen(&block) ⇒ Object
23 24 25 26 27 28 |
# File 'lib/rsmp/collect/listener.rb', line 23 def listen &block @notifier.add_listener self yield ensure @notifier.remove_listener self end |
#notify(message) ⇒ Object
17 18 |
# File 'lib/rsmp/collect/listener.rb', line 17 def notify end |
#notify_error(error, options = {}) ⇒ Object
20 21 |
# File 'lib/rsmp/collect/listener.rb', line 20 def notify_error error, ={} end |