Bug #7112

File.extname documentation fix

Added by Noah Silas over 1 year ago. Updated over 1 year ago.

[ruby-core:47852]
Status:Closed
Priority:Normal
Assignee:Zachary Scott
Category:doc
Target version:2.0.0
ruby -v:ruby 1.9.3p194 (2012-04-20 revision 35410) [x86_64-linux] Backport:

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.

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

Associated revisions

Revision 37749
Added by Zachary Scott over 1 year ago

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

History

#1 Updated by Benoit Daloze over 1 year 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 rbfilesextname())
- looking at ruby
encfindextname(), the part after ':' is not kept for NTFS paths.

#2 Updated by Zachary Scott over 1 year ago

Eregon, what do you suggest?

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

#3 Updated by Yusuke Endoh over 1 year ago

  • Status changed from Open to Assigned
  • Assignee set to Eric Hodel

Drbrain, could you handle this?

Yusuke Endoh mame@tsg.ne.jp

#4 Updated by Eric Hodel over 1 year 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.

#5 Updated by Zachary Scott over 1 year ago

  • Assignee changed from Eric Hodel to Zachary Scott
  • Target version set to 2.0.0

#6 Updated by Zachary Scott over 1 year 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. [Bug #7112]

Also available in: Atom PDF