summaryrefslogtreecommitdiff
path: root/lib/rinda
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rinda')
-rw-r--r--lib/rinda/tuplespace.rb9
1 files changed, 7 insertions, 2 deletions
diff --git a/lib/rinda/tuplespace.rb b/lib/rinda/tuplespace.rb
index cb86b47221..d5042e00c6 100644
--- a/lib/rinda/tuplespace.rb
+++ b/lib/rinda/tuplespace.rb
@@ -316,8 +316,13 @@ module Rinda
# Removes +tuple+ from the TupleBag.
def delete(tuple)
- size = tuple.size
- @hash.fetch(size, []).delete(tuple)
+ key = tuple.size
+ ary = @hash[key]
+ return unless ary
+ pos = ary.rindex(tuple)
+ return unless pos
+ ary.delete_at(pos)
+ @hash.delete(key) if ary.empty?
end
##