Singleton Classes & Class Methods

Where do class methods actually live?

You've written def self.roster a hundred times. Here's the question that reveals whether you understand it: a method belongs to a class, and instances look it up in their class β€” so where does a class method live, given that a class is itself an object? The answer is the singleton class (a.k.a. metaclass or eigenclass): a hidden, per-object class that holds methods belonging to that one object alone.

In an interview, say: "A class method is a singleton method on the class object. def self.foo defines foo in the class's singleton class, which is why instances can't see it but the class can. Class methods aren't a separate feature β€” they're the object model applied to the class-as-an-object."