summaryrefslogtreecommitdiff
path: root/lib/drb/observer.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/drb/observer.rb')
-rw-r--r--lib/drb/observer.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/lib/drb/observer.rb b/lib/drb/observer.rb
new file mode 100644
index 00000000000..e7f1668c526
--- /dev/null
+++ b/lib/drb/observer.rb
@@ -0,0 +1,22 @@
+require 'observer'
+
+module DRb
+ module DRbObservable
+ include Observable
+
+ def notify_observers(*arg)
+ if defined? @observer_state and @observer_state
+ if defined? @observer_peers
+ for i in @observer_peers.dup
+ begin
+ i.update(*arg)
+ rescue
+ delete_observer(i)
+ end
+ end
+ end
+ @observer_state = false
+ end
+ end
+ end
+end