inject and each_with_object

There is no performance difference but the hash in block is reversed:

# inject carry over last returned value from the block
array.inject({}) do |hash, e|
  hash.merge(e => 1)
end

# each_with_object will keep carrying over the `hash`
array.each_with_object({}) do |e, hash|
  hash[e] = 1
end