Module: DRb::Observable

Includes:
Observable
Included in:
DRbObservablePool::SyncObserver
Defined in:
lib/drb/observable.rb

Instance Method Summary collapse

Methods included from Observable

#add_observers, included, #list_observers, #observer?

Instance Method Details

#notify_observer(observer, *arg, &block) ⇒ Object



35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/drb/observable.rb', line 35

def notify_observer(observer, *arg, &block)
  if defined? @observer_state and @observer_state
    if defined? @observer_peers
      if @observer_peers.include?(observer)
        begin
          observer.update(*arg, &block)
        rescue
          delete_observer(observer)
        end
      end
    end
    @observer_state = false
  end
end

#notify_observers(*args, &block) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/drb/observable.rb', line 20

def notify_observers(*args, &block)
  if defined? @observer_state and @observer_state
	if defined? @observer_peers
	  for i in @observer_peers.dup
 begin
   i.update(*args, &block)
 rescue
   delete_observer(i)
 end
	  end
	end
	@observer_state = false
  end
end