- 28 December 2016
- Ruby
- each_with_object as an alternative to inject
Recently I described how to use inject
to solve relatively complex tasks in one-two lines of code.
Today I want to describe another useful method from Enumerable
module - each_with_object
.