module Enumerable
Public Instance Methods
to_hash()
click to toggle source
Get a hash representation of an array. The number of flattened array elements has to be even in order for this to work.
Example: [:foo, :bar, :baz, :qux].to_hash #=> {:foo => :bar, :baz => :qux}
Returns: Hash object
# File lib/extra_lib/core_ext/enumerable.rb, line 9 def to_hash Hash[*to_a.flatten] end