From c12e150b1f22c290490c01de19ab8e11df8ab0db Mon Sep 17 00:00:00 2001 From: Benjamin Kellermann Date: Mon, 7 Dec 2009 23:25:41 +0100 Subject: fix db index issue --- hash.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'hash.rb') diff --git a/hash.rb b/hash.rb index df46cf0..5e99a57 100644 --- a/hash.rb +++ b/hash.rb @@ -18,6 +18,12 @@ ############################################################################ class Hash + #################################################### + # compare self with other hash # + # in the order of fieldarray # + # {1=>a,2=>b}.compare_by_values({1=>c,2=>d},[2,1]) # + # -> compares b,d and afterwards a,c # + #################################################### def compare_by_values(other, fieldarray) return 0 if fieldarray.size == 0 return 1 if self[fieldarray[0]].nil? -- cgit v1.2.3