invert()
public
Returns a new hash created by using hsh’s values as keys, and the keys as values.
h = { "n" => 100, "m" => 100, "y" => 300, "d" => 200, "a" => 0 }
h.invert
Show source
static VALUE
rb_hash_invert(VALUE hash)
{
VALUE h = rb_hash_new();
rb_hash_foreach(hash, rb_hash_invert_i, h);
return h;
}