Last Updated: February 25, 2016
·
424
· bnadlerjr

Turn a Ruby Array into a Hash

I always forget the syntax for this:

ary = [:a, 1, :b, 2, :c, 3]
Hash[*ary] # => { :a => 1, :b => 2, :c => 3 }