From 858e38c90202dbbf07eb9ffd4b59cf058368f29c Mon Sep 17 00:00:00 2001 From: seki Date: Sun, 29 Apr 2007 16:21:31 +0000 Subject: [PATCH] * lib/rinda/tuplespace.rb (TupleSpace#create_entry, TupleBag#push, delete): extract method, and rename parameter. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@12229 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ lib/rinda/tuplespace.rb | 22 +++++++++++++--------- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2da62025fe..d7abe538cd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Mon Apr 30 01:17:51 2007 Masatoshi SEKI + + * lib/rinda/tuplespace.rb (TupleSpace#create_entry, TupleBag#push, + delete): extract method, and rename parameter. + Fri Apr 27 02:00:17 2007 Ryan Davis * signal.c: Fixed backwards compatibility for 'raise Interrupt'. diff --git a/lib/rinda/tuplespace.rb b/lib/rinda/tuplespace.rb index 73e79bb401..cb86b47221 100644 --- a/lib/rinda/tuplespace.rb +++ b/lib/rinda/tuplespace.rb @@ -304,20 +304,20 @@ module Rinda end ## - # Add +ary+ to the TupleBag. + # Add +tuple+ to the TupleBag. - def push(ary) - size = ary.size + def push(tuple) + size = tuple.size @hash[size] ||= [] - @hash[size].push(ary) + @hash[size].push(tuple) end ## - # Removes +ary+ from the TupleBag. + # Removes +tuple+ from the TupleBag. - def delete(ary) - size = ary.size - @hash.fetch(size, []).delete(ary) + def delete(tuple) + size = tuple.size + @hash.fetch(size, []).delete(tuple) end ## @@ -403,7 +403,7 @@ module Rinda # Adds +tuple+ def write(tuple, sec=nil) - entry = TupleEntry.new(tuple, sec) + entry = create_entry(tuple, sec) start_keeper synchronize do if entry.expired? @@ -529,6 +529,10 @@ module Rinda private + def create_entry(tuple, sec) + TupleEntry.new(tuple, sec) + end + ## # Removes dead tuples.