Interesting. I almost never use reduce or each_with_object. Usually when I see people use these, what they really want is either something likethings.index_by(&:id), or Hash[values.map { |value| [value, foo(value)] }]. reduce is for the very special case where each subsequent value cares about the preceding state of the accumulator.

Advocate of Score Voting and Approval Voting. Software engineer. Father. Husband. American.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store