OSDN Git Service

ruby-1.9.1-rc1
[splhack/AndroidRuby.git] / lib / ruby-1.9.1-rc1 / sample / drb / ring_inspect.rb
1 require 'rinda/ring'
2 require 'drb/drb'
3
4 class Inspector
5   def initialize
6   end
7
8   def primary
9     Rinda::RingFinger.primary
10   end
11
12   def list_place
13     Rinda::RingFinger.to_a
14   end
15
16   def list(idx = -1)
17     if idx < 0
18       ts = primary
19     else
20       ts = list_place[idx]
21       raise "RingNotFound" unless ts
22     end
23     ts.read_all([:name, nil, nil, nil])
24   end
25 end
26
27 def main
28   DRb.start_service
29   r = Inspector.new
30 end