Iterator

Iterator: step through a collection without exposing internals

Problem: callers want to walk your collection in order without knowing whether it's an array, a tree, or a linked list inside.

Say it plainly: in Ruby this is nearly built in. Define each, include Enumerable, and you get map, select, sort, to_a, and dozens more for free.

PawWalk scenario: iterate a booking calendar in order β€” callers just call .each or .map and never see the storage.