Say I have a hash like this
{"k1"=>["v1"], "k2"=>["v2"], "k3"=>["v3"], "k4"=>["v4"]}
And I want it to look like this:
{"k1"=>"v1", "k2"=>"v2", "k3"=>"v3", "k4"=>"v4"}
Is there a simpler way to do it than this ugly inject?
h1 = {"k1"=>["v1"], "k2"=>["v2"], "k3"=>["v3"], "k4"=>["v4"]}
h2 = h1.inject({}){|h,v| h[v.first]=v.last.first; h}