Contents

Roo

Hash.invert

Returns a new Hash object created using this Hash object’s values as keys and the keys as values. If a key with the same name already exists in the new hash then the last one encountered will be used with earlier values being discarded. The original Hash is unaltered.

var h = {"a" => 10, "b" => 20, "c" => 30}
var i = h.invert # => {10 => "a", 20 => "b", 30 => "c"}