
Vladimir Prus wrote:
Frank Mori Hess wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1
[snip]
Unless you want 'leaf' to be named 'basename'. See, we already have 'basename', which unfortunately does something different.
[sorry for jumping in] I personally have no problems with leaf, but just for comparison, the following is from Ruby (note that extension can be conditionally removed):
ri File.basename --------------------------------------------------------- File::basename File.basename(file_name [, suffix] ) -> base_name
Returns the last component of the filename given in _file_name_, which must be formed using forward slashes (``+/+'') regardless of the separator used on the local file system. If _suffix_ is given and present at the end of _file_name_, it is removed. File.basename("/home/gumby/work/ruby.rb") #=> "ruby.rb" File.basename("/home/gumby/work/ruby.rb", ".rb") #=> "ruby"
ri Pathname.basename
------------------------------------------------------ Pathname#basename basename(*args) ------------------------------------------------------------------------ See +File.basename+. Returns the last component of the path. / Johan