From: Yehuda Katz Date: 2011-11-15T05:28:48+09:00 Subject: [ruby-core:41041] Re: [ruby-trunk - Feature #5628] Module#basename --0016363ba20cc4ebae04b1b7b766 Content-Type: text/plain; charset=ISO-8859-1 I would probably be ok with mod.modules.last.name to be honest. Yehuda Katz (ph) 718.877.1325 On Mon, Nov 14, 2011 at 7:12 AM, Thomas Sawyer wrote: > > 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 > > --0016363ba20cc4ebae04b1b7b766 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable I would probably be ok with mod.mo= dules.last.name to be honest.

Yehuda Katz
(ph) 71= 8.877.1325


On Mon, Nov 14, 2011 at 7:12 AM, Thomas = Sawyer <transfi= re@gmail.com> wrote:

Issue #5628 has been updated by Thomas Sawyer.


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

In my defense, I always thought File class methods for file handling were b= ad mojo! It would be much better if Pathname were core and File class metho= ds 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:

=A0 =A0some_module.name.split("::").last

It's useful for things like factory methods. It would be much nicer if = we had:

=A0 =A0class Module
=A0 =A0 =A0def basename
=A0 =A0 =A0 =A0name.split("::").last
=A0 =A0 =A0end
=A0 =A0end




--
http://redmine.r= uby-lang.org


--0016363ba20cc4ebae04b1b7b766--