idiomatic-code-golf

Even idiomatic usage of a language can end up looking a bit like code golf. Inject in Ruby is a good example.

book-refactoring-ruby-edition#inject-takes-getting-used-to

If you need to do something in a loop that produces a single value, such as a sum, consider using the inject method. This can take a little getting used to.