Here Be Dragons

Because of the sharp knives Ruby provides to its programmers, it’s easy to define operators for any class. So if I have a bottle class, I can define what it means to add something to that bottle: def +(other).

And that’s just the tip of the iceberg. Unary definitions are also possible, like def +@ (unary addition), or def ! (the ‘not’ operator).

Careful not to cut yourself…