From: Todd Corenson Date: 2007-11-06T09:49:38+09:00 Subject: Re: Superclass of a module Does this make Foo a singleton class of Module? This would explain how Foo could respond to super, yet have no superclass. But this would still be strange because module Foo def self.append_features(b) super end end would make append_features a module method and yet Module.new.respond_to?(:append_features, true) is true. For a class, this implies that append_features would be an instance method. I take it this works differently for modules? Mental Guy wrote: > On Tue, 6 Nov 2007 07:38:01 +0900, Todd Corenson > 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 -- Posted via http://www.ruby-forum.com/.