Why does Ruby module inclusion exclude the module's singleton class?
Unless anyone can come up with a compelling argument, i feel that the limitation is just down to implementation difficulty. Nonetheless i've been working on the problem the last couple of days and have (in beta) a new version of include called include_complete
that gets around these difficulties and allows modules inheritance to work like class inheritance (bringing in the singleton)
Check out the project here: http://github.com/banister/include_complete
And beware the project is still very much in beta, but still seems to work as desired so far
Warning: the following is just speculation.
If you're using a class, you'll need singleton class methods, because you rely on them to create the object (eg MyClass.new
). If you're using a module, you don't need them, because you can't create objects purely from a module.