From 2b992edf51a5a4674c89abd04a5e03ec9f502228 Mon Sep 17 00:00:00 2001 From: seki Date: Wed, 21 Apr 2004 14:00:34 +0000 Subject: check hash tuple size git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@6192 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/rinda/rinda.rb | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) (limited to 'lib/rinda') 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) -- cgit v1.2.3