Reverse keys and values in a hash

Hello all,

This is more of a ruby question than a rails question, but I’m
wondering if it’s possible to reverse the keys and values in a hash.

I’m using a hash to map fields from one component of my app to
another, and sometimes the data needs to go “the other way”…

Thanks!

http://www.noobkit.com/show/ruby/ruby/ruby-core/hash/invert.html

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs