Want to see the full-length video right now for free?
In this episode, Ben and Joe tackle a highly useful but lesser known method
from Ruby's Enumerable module: inject.
While watching, you'll see how inject is just an abstraction over certain
types of recursion. We'll use examples to demonstrate inject's many uses,
including calculations on lists, implementing laziness for streaming large data
sets, and building recursive data structures like Rack middleware chains.
You can read more about inject in the official documentation.
Ruby's inject is a Fold Function. You can read more about this concept on C2
Wiki or Wikipedia.