2003-06-18 19:45:12 +04:00
|
|
|
require 'observer'
|
|
|
|
|
|
|
|
module DRb
|
2013-01-25 07:25:39 +04:00
|
|
|
# The Observable module extended to DRb. See Observable for details.
|
2003-06-18 19:45:12 +04:00
|
|
|
module DRbObservable
|
|
|
|
include Observable
|
|
|
|
|
2013-01-25 07:25:39 +04:00
|
|
|
# Notifies observers of a change in state. See also
|
|
|
|
# Observable#notify_observers
|
2003-06-18 19:45:12 +04:00
|
|
|
def notify_observers(*arg)
|
|
|
|
if defined? @observer_state and @observer_state
|
2009-03-01 18:57:33 +03:00
|
|
|
if defined? @observer_peers
|
|
|
|
@observer_peers.each do |observer, method|
|
|
|
|
begin
|
|
|
|
observer.send(method, *arg)
|
|
|
|
rescue
|
|
|
|
delete_observer(observer)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
@observer_state = false
|
2003-06-18 19:45:12 +04:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|