diff options
author | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-21 14:05:40 +0000 |
---|---|---|
committer | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-21 14:05:40 +0000 |
commit | fb3c76a225a314a3583250ae6e92f41fce0e371f (patch) | |
tree | ef0e2449884ade7fd4f021694ea996b0a9fb095b /lib/rinda | |
parent | 317547dc5d2ec69412b7b2e769f67598285c7fe3 (diff) | |
download | ruby-fb3c76a225a314a3583250ae6e92f41fce0e371f.tar.gz |
check hash tuple size
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@6193 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/rinda')
-rw-r--r-- | lib/rinda/rinda.rb | 7 |
1 files changed, 2 insertions, 5 deletions
diff --git a/lib/rinda/rinda.rb b/lib/rinda/rinda.rb index 0352a7be90..50fb84696a 100644 --- a/lib/rinda/rinda.rb +++ b/lib/rinda/rinda.rb @@ -69,18 +69,15 @@ module Rinda private def init_with_ary(ary) - @tuple_size = ary.size - @tuple = Array.new(@tuple_size) + @tuple = Array.new(ary.size) @tuple.size.times do |i| @tuple[i] = ary[i] end end def init_with_hash(hash) - @tuple_size = hash[:size] @tuple = Hash.new hash.each do |k, v| - next if k == :size raise InvalidHashTupleKey unless String === k @tuple[k] = v end @@ -97,7 +94,7 @@ module Rinda def match(tuple) return false unless tuple.respond_to?(:size) return false unless tuple.respond_to?(:fetch) - return false if @tuple_size && (@tuple_size != tuple.size) + return false unless self.size == tuple.size each do |k, v| begin it = tuple.fetch(k) |