[Solved] Ruby combine hashes? [closed]


a = {:a => :b}
b = {:b => :c}

# Works on ruby >= 2.1
c = a.map{|k, v| [k, b[v]]}.to_h  #=> {:a => :c}

# Works on all versions of ruby
c = Hash[a.map{|k, v| [k, b[v]]}]  #=> {:a => :c}

solved Ruby combine hashes? [closed]