Join GitHub today
GitHub is home to over 31 million developers working together to host and review code, manage projects, and build software together.Sign up
JRuby behaves different from MRI and Rubinius when it comes to setting Module#name #497
The problem appears to manifest when a class inherits from
In the case above,
I think I might see the problem here. When the A class is defined, it does get its name (RubyModule.baseName) set properly. However, by the time we reach the to_s, the metaclass for the A instance appears to be a new singleton class. As a result, it ends up following logic for building a singleton class name, which gives us the Module version instead of the A version.
This could either be a problem with how we calculate the singleton name for a module subclass, or potentially as simple as Module.new (getting called for A.new) always creating a new anonymous module.