If inject had a better name, then it would be easier for us rookies to remember that it’s the right way to accumulate values across an array:
1
irb(main):001:0> (1..10).inject(0) { |s,v| s += v }
=> 55
Might I suggest something along the line of:
- accumulate
- assemble
- gather (my favorite)