Ruby array to hash: each element the key and derive value from it
You can:
a = ['a', 'b']
Hash[a.map {|v| [v,v.upcase]}]
%w{a b c}.reduce({}){|a,v| a[v] = v.upcase; a}
Ruby's each_with_object
method is a neat way of doing what you want
['a', 'b'].each_with_object({}) { |k, h| h[k] = k.upcase }