aboutsummaryrefslogtreecommitdiff
path: root/hash.rb
diff options
context:
space:
mode:
authorBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-12-07 23:25:41 +0100
committerBenjamin Kellermann <Benjamin.Kellermann@gmx.de>2009-12-07 23:25:41 +0100
commitc12e150b1f22c290490c01de19ab8e11df8ab0db (patch)
tree61691d489e4d8f36ac46263261331968b8695ac4 /hash.rb
parent48cd11e7ce34348bc91b144ffbcd46e0e90a8bc0 (diff)
fix db index issue
Diffstat (limited to 'hash.rb')
-rw-r--r--hash.rb6
1 files changed, 6 insertions, 0 deletions
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?