Project

General

Profile

Actions

Feature #5628

open

Module#basename

Added by trans (Thomas Sawyer) over 10 years ago. Updated over 1 year ago.

Status:
Feedback
Priority:
Normal
Target version:
-
[ruby-core:41004]

Description

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
Actions

Also available in: Atom PDF