State

State: behavior changes with internal state

Problem: an object behaves differently depending on which state it's in, and only certain transitions are legal.

PawWalk scenario: a booking machine β€” requested -> confirmed -> in_progress -> completed, with cancelled reachable from a few states. Illegal jumps must be rejected.

A clean Ruby realization: a map of allowed transitions and a transition method that consults it, raising on an illegal move.