Chapter 13. Object individuation
In this chapter
- Singleton methods and classes
- Class methods
- The extend method
- Overriding Ruby core behavior
- The BasicObject class
One of the cornerstones of Ruby’s design is the ability of individual objects to behave differently from other objects of the same class. Every object is a full-fledged citizen of the runtime world of the program and can live the life it needs to.
The freedom of objects to veer away from the conditions of their birth has a kind of philosophical ring to it. On the other hand, it has some important technical implications. A remarkable number of Ruby features and characteristics derive from or converge on the individuality of objects. Much of Ruby is engineered to make object individuation possible. Ultimately, the individuation is more important than the engineering: Matz has said over and over again that the principle of object individuality is what matters, and how Ruby implements it is secondary. Still, the implementation of object individuation has some powerful and useful components.