From 59ca946543058a68ae94405061c0c1be6275a84a Mon Sep 17 00:00:00 2001 From: hsbt Date: Thu, 21 Aug 2014 04:23:56 +0000 Subject: [PATCH] * 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 --- ChangeLog | 5 +++++ lib/rinda/ring.rb | 24 ------------------------ sample/rinda-ring.rb | 22 ++++++++++++++++++++++ 3 files changed, 27 insertions(+), 24 deletions(-) create mode 100644 sample/rinda-ring.rb diff --git a/ChangeLog b/ChangeLog index 77baadbb49..b4ae70ca8a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Aug 21 13:23:34 2014 SHIBATA Hiroshi + + * lib/rinda/ring.rb: split executable code into sample directory. + * sample/rinda-ring.rb: ditto. + Thu Aug 21 13:21:45 2014 SHIBATA Hiroshi * lib/drb/acl.rb: split executable code into sample directory. diff --git a/lib/rinda/ring.rb b/lib/rinda/ring.rb index e36c93b0a3..fe33420494 100644 --- a/lib/rinda/ring.rb +++ b/lib/rinda/ring.rb @@ -478,27 +478,3 @@ module Rinda end end - -if __FILE__ == $0 - 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 -end - diff --git a/sample/rinda-ring.rb b/sample/rinda-ring.rb new file mode 100644 index 0000000000..f9bd934029 --- /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