lib/core/facets/hash/inverse.rb in facets-2.8.4 vs lib/core/facets/hash/inverse.rb in facets-2.9.0.pre.1

- old
+ new

@@ -2,13 +2,16 @@ # Create a "true" inverse hash by storing mutliple values in Arrays. # # h = {"a"=>3, "b"=>3, "c"=>3, "d"=>2, "e"=>9, "f"=>3, "g"=>9} # - # h.invert #=> {2=>"d", 3=>"f", 9=>"g"} - # h.inverse #=> {2=>"d", 3=>["f", "c", "b", "a"], 9=>["g", "e"]} - # h.inverse.inverse #=> {"a"=>3, "b"=>3, "c"=>3, "d"=>2, "e"=>9, "f"=>3, "g"=>9} - # h.inverse.inverse == h #=> true + # h.invert #=> {2=>"d", 3=>"f", 9=>"g"} + # h.inverse #=> {2=>"d", 3=>["f", "c", "b", "a"], 9=>["g", "e"]} + # h.inverse.inverse #=> {"a"=>3, "b"=>3, "c"=>3, "d"=>2, "e"=>9, "f"=>3, "g"=>9} + # + # Of course the inverse of the inverse should be the same. + # + # (h.inverse.inverse == h) #=> true # # CREDIT: Tilo Sloboda def inverse i = Hash.new