Give anonymous modules and classes names when they are inspected.
fancy_module=Named::Module.new('FancyModule')dodefmodule_methodputs'Hello from the module'endendfancy_module.inspect# => "Named::Module:FancyModule:0x7fa9ea9e6178"# subclasses Arrayfancy_class=Named::Class.new('FancyClass',Array)dodefclass_methodputs'Hello from the class'endend# Inspection string shows the superclassfancy_class.inspect=>"Named::Class:Array:FancyClass:0x7fa9ea8aaea8"fancy_class.send(:include,fancy_module)fancy_class.ancestors# => [Named::Class:Array:FancyClass:0x7fa9ea8aaea8,# Named::Module:FancyModule:0x7fa9ea9e6178,# Named::Class, Named::Naming,# Array, Kernel, BasicObject]instance=fancy_class.newinstance.module_method# => 'Hello from the module'instance.class_method# => 'Hello from the class'Add this line to your application's Gemfile:
gem 'named'
And then execute:
$ bundle
Or install it yourself as:
$ gem install named
- Fork it
- Create your feature branch (
git checkout -b my-new-feature) - Commit your changes (
git commit -am 'Add some feature') - Push to the branch (
git push origin my-new-feature) - Create new Pull Request

