Also, I think you could just as well do this with #each_with_object({}), which if I recall, has better performance that #reduce and does not require the accumulator to be returned at the end of the block.