From: Gavin Kistner Date: 2004-11-10T23:53:44+09:00 Subject: Re: Iterating trough hash On Nov 9, 2004, at 9:08 AM, Kevin B�rgens wrote: > I have a hash and I want to iterate trough all pairs of values. An > example: It's for arrays, not hashes, but I have a #each_unique_pair method for arrays: http://phrogz.net/RubyLibs/rdoc/classes/Array.html#M000066 Source code is: def each_unique_pair self.each_with_index{ |a,i| self[(i+1)..-1].each{ |b| yield a,b } } end With a little manipulation of the hash, you should be able to get it into a format that the above would work with.