diff options
author | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-29 16:21:31 +0000 |
---|---|---|
committer | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2007-04-29 16:21:31 +0000 |
commit | 858e38c90202dbbf07eb9ffd4b59cf058368f29c (patch) | |
tree | f94839d30b5edd7963aae2c3ea3d988ce16daf85 /lib/rinda | |
parent | dda452747887037dc5f1969b3f23403bb592c084 (diff) |
* 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
Diffstat (limited to 'lib/rinda')
-rw-r--r-- | lib/rinda/tuplespace.rb | 22 |
1 files changed, 13 insertions, 9 deletions
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. |