Issue #5628 has been updated by fatkodima (Dima Fatko).


Used this numerous times.

I like this suggestion:

regularfry (Alex Young) wrote in #note-4:
>    .name( false )
>    .name( :full => false )

What ruby-core think on this?

----------------------------------------
Feature #5628: Module#basename
https://bugs.ruby-lang.org/issues/5628#change-87287

* Author: trans (Thomas Sawyer)
* Status: Feedback
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
----------------------------------------
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





-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>