Create a hash from an array with Hash[*arr]
The Hash::[] class method can be used in addition to the splat operator to create a hash from an array.
arr = [:a, 1, :b, 2] Hash[*arr] # => {:a => 1, :b => 2}The Hash::[] class method can be used in addition to the splat operator to create a hash from an array.
arr = [:a, 1, :b, 2] Hash[*arr] # => {:a => 1, :b => 2}