More fun with extend.
To complement a previous post about using extend, here’s a fun tidbit:
module Consume def eat "You eat a carrot." end end String.extend(Consume) String.eat # You eat a carrot. s = String.new s.extend(Consume) s.eat # You eat a carrot.
Moral of the story? The extend method can be used at the class- or instance-level. Neato!