MenTaLguY
11/5/2007 10:57:00 PM
On Tue, 6 Nov 2007 07:38:01 +0900, Todd Corenson <todd@browsersys.com> wrote:
> Is this where append_features is actually defined? And if user-defined
> modules have superclasses, why don't the superclass and ancestors
> methods report this class?
Foo.append_features works because Foo is a Module (Foo.class == Module),
and Module#append_features is defined, the same way it would work for
any other sort of object.
Classes are the only special case; if Bar were a class, calling e.g.
Bar.hoge would also search the singleton methods defined on the classes in
Bar.ancestors, in addition to searching the regular instance methods on
Bar.class.ancestors.
-mental