I would like to do a.each_with_object with index, in a better way than this:
a.each_with_object
index
a = %w[a b c] a.each.with_index.each_with_object({}) { |ar
In your example .each.with_index is redundant. I found this solution:
.each.with_index
['a', 'b', 'c'].each_with_object({}).with_index do |(el, acc), index| acc[index] = el end # => {0=>"a", 1=>"b", 2=>"c"}