summaryrefslogtreecommitdiff
path: root/sample
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-21 04:23:56 (GMT)
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-08-21 04:23:56 (GMT)
commit59ca946543058a68ae94405061c0c1be6275a84a (patch)
tree0af766b5ae0f69598668331c5f95d548dd8f2695 /sample
parentbff692b94d74de24fe9b50a515f4bc844c3fb5be (diff)
* 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
Diffstat (limited to 'sample')
-rw-r--r--sample/rinda-ring.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/sample/rinda-ring.rb b/sample/rinda-ring.rb
new file mode 100644
index 0000000..f9bd934
--- /dev/null
+++ b/sample/rinda-ring.rb
@@ -0,0 +1,22 @@
+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