The smallest object possible in Ruby
It's o = BasicObject.allocate.
First, understand that BasicObject is a "blank state" class in Ruby: when an instance of BasicObject is created, only a handful methods are provided to the instance.
However, the way we declare new class instances is through the .new method. Internally, .new calls .allocate and then .initialize (yes, THAT initialize!). Which means, to create a new object, we can simply call .allocate.
In our example, o does not know anything about itself. it does not respond to methods such as .class, .superclass, .methods, .inspect... o is blissfully ignorant of it's origins, it only has 8 public methods and 4 private methods (plus a private .initialize ), all defined here.
Yet, o can be extended by defining singleton methods.
Note: BasicObject on itself has all the methods defined by Class, which in turn is descendant of Module and then Object, circling back to BasicObject as it's superclass. It's kinda confusing because the classes themselves are descendants of the Class class. In other words, there's a circular dependency going on, which I still cannot explain satisfactoryly.