diff options
| author | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-21 14:00:34 +0000 |
|---|---|---|
| committer | seki <seki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2004-04-21 14:00:34 +0000 |
| commit | 05f24f68bd26182e91aae0806f4eb4beef7c9974 (patch) | |
| tree | 777f67ed93e6141512d35559f2e5619eb4944072 /lib | |
| parent | 844dd901442667e149844c49a2280cc9d51215f2 (diff) | |
| download | ruby-05f24f68bd26182e91aae0806f4eb4beef7c9974.tar.gz ruby-05f24f68bd26182e91aae0806f4eb4beef7c9974.tar.xz ruby-05f24f68bd26182e91aae0806f4eb4beef7c9974.zip | |
check hash tuple size
git-svn-id: http://svn.ruby-lang.org/repos/ruby/branches/ruby_1_8@6192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
| -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 0352a7be9..50fb84696 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) |
