Project

General

Profile

Actions

Bug #7112

closed

File.extname documentation fix

Added by noah256 (Noah Silas) about 12 years ago. Updated about 12 years ago.

Status:
Closed
Assignee:
Target version:
ruby -v:
ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux]
Backport:
[ruby-core:47852]

Description

The documentation says that File.extname returns the portion of the filename after the period, while the actual output includes the period. Update the documentation to reflect this.


Files

ruby_file_extname.patch (434 Bytes) ruby_file_extname.patch File.extname doc patch noah256 (Noah Silas), 10/06/2012 11:59 AM

Updated by Eregon (Benoit Daloze) about 12 years ago

Good catch!

There are a few special cases:

  • dotfiles (e.g.: ".hidden") have "" for extname and ".hidden" for basename.
  • files ending with a dot report "" as extname (done by rb_file_s_extname())
  • looking at ruby_enc_find_extname(), the part after ':' is not kept for NTFS paths.

Updated by zzak (zzak _) about 12 years ago

Eregon, what do you suggest?

I sorta feel like covering every special case would be bad, but maybe add a few more examples?

Updated by mame (Yusuke Endoh) about 12 years ago

  • Status changed from Open to Assigned
  • Assignee set to drbrain (Eric Hodel)

Drbrain, could you handle this?

--
Yusuke Endoh

Updated by drbrain (Eric Hodel) about 12 years ago

I think adding documentation for dotfiles and files ending with a dot would be sufficient.

I don't think covering filesystem-specific behavior is necessarily useful.

Updated by zzak (zzak _) about 12 years ago

  • Assignee changed from drbrain (Eric Hodel) to zzak (zzak _)
  • Target version set to 2.0.0
Actions #6

Updated by zzak (zzak _) about 12 years ago

  • Status changed from Assigned to Closed
  • % Done changed from 0 to 100

This issue was solved with changeset r37749.
Noah, thank you for reporting this issue.
Your contribution to Ruby is greatly appreciated.
May Ruby be with you.


  • file.c (File.extname): Documentation for extname on dotfiles and
    files ending with a dot. Also, added example for this.
    [ruby-core:47852] [Bug #7112]
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0Like0