In fact, it looks like [Hash#invert](http://www.ruby-doc.org/core-2.1.0/Hash.html#method-i-invert) will do what you want.