Inheritance of Singleton Class
suggest changeSubclassing also Subclasses Singleton Class
class Example
end
Example.singleton_class #=> #<Class:Example>
def Example.foo
:example
end
class SubExample < Example
end
SubExample.foo #=> :example
SubExample.singleton_class.superclass #=> #<Class:Example>
Extending or Including a Module does not Extend Singleton Class
module ExampleModule
end
def ExampleModule.foo
:foo
end
class Example
extend ExampleModule
include ExampleModule
end
Example.foo #=> NoMethodError: undefined method
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents