Invert a hash
Hash#invert
returns a new Hash object with the each key-value pair inverted:
{first: 1, last: 2}.invert
=> {
1 => :first,
2 => :last
}
{first: 1, last: 2}.invert[2]
=> :last
Tweet
Hash#invert
returns a new Hash object with the each key-value pair inverted:
{first: 1, last: 2}.invert
=> {
1 => :first,
2 => :last
}
{first: 1, last: 2}.invert[2]
=> :last
Tweet