First page Back Continue Last page Overview Text


Here's an example of the method lookup process for a class method of Bignum.

Let's extend the integer class with a new module, which includes the module in Integer's singleton class.

It tries the singleton classes of Bignum and Integer, then module that extends Integer, then the singleton class of Numeric.

Since Numeric's superclass is Object, the singleton class of Numeric's superclass is Class, so it tries that next, followed by Module, Object, and finally Kernel, a module included in Object.