From: Gavin Sinclair Date: 2004-09-09T13:36:47+09:00 Subject: Re: [RCR] Unified type conversion framework > Well, as long as we're playing "show me yours and I'll show you mine," I > use (again, very similar): I like that game :) > > module Enumerable > def collect_hash > result = {} > each { |x| result[x] = yield(x) } > result > end > end > > and thus would write (for the initial): > > db.select_all(...).collect_hash { |foo, bar| bar } > > -- Markus You don't see a need for transforming the keys? db.select_all(...).build_hash { |foo, bar| [foo.to_i, bar.to_s] } Gavin