digital-fabric/modulation

Module classes are defined under module's singleton class, ugly when inspected

noteflakes opened this issue · 0 comments

Right now, a class defined in a module, e.g.:

# m.rb
export :C

class C; end

...will have an unsightly namespace when inspected:

import('m')::C #=> #<Class:0x000055b5da3b6100>::C

The namespace is actually the module's singleton class. I don't really see any solution to have the constant defined straight on the module, short of overhauling the whole way the module is loaded.

The only solution I can see at the moment would be to override the defined module class' inspect method.