Is there a way to pull the values from an array and assign them each a unique key in Ruby?
I want to be able to turn this array:
["12", "21", "1985"]
Into this hash:
{:month => "12", :day => "21", :year => "1985"}
I would rather not assign each value individually, like this:
arr = ["12", "21", "1985"]
bday_hash = {:month => arr[0], :day => arr[1], :year => arr[2]}
ary = ["12", "21", "1985"]; h = { month: ary[0], day: ary[1], year: ary[2] }