Class: RSMP::Listener

Inherits:
Object
  • Object
show all
Includes:
Inspect
Defined in:
lib/rsmp/collect/listener.rb

Direct Known Subclasses

Collector

Instance Method Summary collapse

Methods included from Inspect

#inspect, #inspector

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, options={}
  @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 message
end

#notify_error(error, options = {}) ⇒ Object



20
21
# File 'lib/rsmp/collect/listener.rb', line 20

def notify_error error, options={}
end