From: Thomas Sawyer Date: 2011-11-15T05:59:42+09:00 Subject: [ruby-core:41043] [ruby-trunk - Feature #5628] Module#basename Issue #5628 has been updated by Thomas Sawyer. > I would probably be ok with mod.modules.last.name to be honest. Then might as well add mod.lastname too. If the implementation is anything like the pure-Ruby one, it is more efficient to have a dedicated method. And I much prefer the shorter syntax. If not #lastname then maybe #modname. ---------------------------------------- Feature #5628: Module#basename http://redmine.ruby-lang.org/issues/5628 Author: Thomas Sawyer Status: Open Priority: Normal Assignee: Category: Target version: 1.9.4 Something I use fairly often: some_module.name.split("::").last It's useful for things like factory methods. It would be much nicer if we had: class Module def basename name.split("::").last end end -- http://redmine.ruby-lang.org