Sha256: 0463db62a9475d9f8c28e46c94a6d71d8cdce7a55cb1de7f3e23555c4e9a8887
Contents?: true
Size: 295 Bytes
Versions: 22
Compression:
Stored size: 295 Bytes
Contents
# inverse from Tilo Sloboda (now in facets) class Hash def inverse i = Hash.new self.each_pair do |k,v| if (Array === v) ; v.each{ |x| i[x] = ( i.has_key?(x) ? [k,i[x]].flatten : k ) } else ; i[v] = ( i.has_key?(v) ? [k,i[v]].flatten : k ) end end ; i end end
Version data entries
22 entries across 22 versions & 2 rubygems