Totally agreed. This pattern is fairly common. It would also be nice to
have Module#modules or something, such that Foo::Bar would return [Foo,
Bar].

Yehuda Katz
(ph) 718.877.1325


On Sun, Nov 13, 2011 at 6:17 PM, Thomas Sawyer <transfire / gmail.com> wrote:

>
> Issue #5628 has been reported by Thomas Sawyer.
>
> ----------------------------------------
> 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
>
>