T
todd
In Ruby 1.8, a Module does not have a superclass according to the
superclass and ancestors methods.
E.g.,
module Foo
end
Foo.ancestors # => [Foo]
Foo.superclass # => NoMethodError
Yet,
module Foo
self.append_features(b)
super
end
end
works when append_features is called either directly or when Foo is
included in a class. That is, super finds a superclass where
append_features is defined. According to the docs this class is Module.
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?
superclass and ancestors methods.
E.g.,
module Foo
end
Foo.ancestors # => [Foo]
Foo.superclass # => NoMethodError
Yet,
module Foo
self.append_features(b)
super
end
end
works when append_features is called either directly or when Foo is
included in a class. That is, super finds a superclass where
append_features is defined. According to the docs this class is Module.
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?