~ubuntu-branches/ubuntu/intrepid/ruby1.8/intrepid-updates

« back to all changes in this revision

Viewing changes to sample/drb/ring_inspect.rb

  • Committer: Bazaar Package Importer
  • Author(s): akira yamada
  • Date: 2007-03-13 22:11:58 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20070313221158-h3oql37brlaf2go2
Tags: 1.8.6-1
* new upstream version, 1.8.6.
* libruby1.8 conflicts with libopenssl-ruby1.8 (< 1.8.6) (closes: #410018)
* changed packaging style to cdbs from dbs.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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