One tiny tip.. :) you can pass a block to `.to_h`, so instead of using `.map` + `.to_h`:
h.map { |k,v| [k, v] }.to_h
h.to_h { |k,v| [k, v] }