Composition & Functional Style

Compose small functions into pipelines

Ruby leans object-oriented but has sharp functional tools. Two lambdas (or method objects) compose with >> and <<: f >> g makes a new callable that runs f then feeds its result to g (left-to-right); f << g runs g then f (right-to-left). Small, named, testable steps assembled into a pipeline beats one long method.

In an interview, say: ">> composes callables left-to-right into a pipeline. I use it to build a price calculation out of named, individually-testable steps instead of one procedure β€” each step is pure and the composition documents the flow."