1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/sample/rinda-ring.rb
hsbt 59ca946543 * lib/rinda/ring.rb: split executable code into sample directory.
* sample/rinda-ring.rb: ditto.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47236 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
2014-08-21 04:23:56 +00:00

22 lines
414 B
Ruby

require 'rinda/ring'
DRb.start_service
case ARGV.shift
when 's'
require 'rinda/tuplespace'
ts = Rinda::TupleSpace.new
Rinda::RingServer.new(ts)
$stdin.gets
when 'w'
finger = Rinda::RingFinger.new(nil)
finger.lookup_ring do |ts2|
p ts2
ts2.write([:hello, :world])
end
when 'r'
finger = Rinda::RingFinger.new(nil)
finger.lookup_ring do |ts2|
p ts2
p ts2.take([nil, nil])
end
end