Issue #5628 has been updated by Thomas Sawyer.


You're right. File is also Module (subclass of Class). So, yes, another name is needed, or ::File.basename accepted as an exception.

In my defense, I always thought File class methods for file handling were bad mojo! It would be much better if Pathname were core and File class methods non-existent (IMHO).





----------------------------------------
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