Project

General

Profile

Bug #9002

Use simpler example for File#expand_path

Added by cha1tanya (Prathamesh Sonpatki) about 4 years ago. Updated about 4 years ago.

Status:
Closed
Priority:
Normal
Target version:
ruby -v:
ruby 2.1.0dev (2013-07-20 trunk 42078) [x86_64-linux]
[ruby-core:57734]

Description

Use simpler example for File#exapnd_path when start_directory path is given.

Associated revisions

Revision 43386
Added by Eregon (Benoit Daloze) about 4 years ago

  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

Revision 43386
Added by Eregon (Benoit Daloze) about 4 years ago

  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

Revision 43386
Added by Eregon (Benoit Daloze) about 4 years ago

  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

Revision 43386
Added by Eregon (Benoit Daloze) about 4 years ago

  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

History

#1 [ruby-core:57807] Updated by Eregon (Benoit Daloze) about 4 years ago

I don't know, the original example shows File.expand_path does resolve ".." and such.
Your example could be interpreted as File.expand_path being just File.join with reversed arguments.
On the other hand, ".." could be used just once in the example and probably still be clear (going to "/" does not make a lot of sense, one could just use "/bin" directly).

#2 [ruby-core:57820] Updated by cha1tanya (Prathamesh Sonpatki) about 4 years ago

Can we give both examples? I think the original example is a bit hard to understand due to two "..". In the first example we can show normal use and in second example, as you pointed out, how to resolve "..".
Eregon (Benoit Daloze) wrote:

I don't know, the original example shows File.expand_path does resolve ".." and such.
Your example could be interpreted as File.expand_path being just File.join with reversed arguments.
On the other hand, ".." could be used just once in the example and probably still be clear (going to "/" does not make a lot of sense, one could just use "/bin" directly).

#3 [ruby-core:57885] Updated by zzak (Zachary Scott) about 4 years ago

  • Status changed from Open to Assigned

The original makes no sense to me, but I can see how it resolves ".." (... somehow).

I'm not even sure what the "/tmp/x" has to do with anything.

A patch to explain what's going on there would be nice, at least for my own sake :D

#4 [ruby-core:57939] Updated by Eregon (Benoit Daloze) about 4 years ago

cha1tanya (Prathamesh Sonpatki) wrote:

Can we give both examples? I think the original example is a bit hard to understand due to two "..". In the first example we can show normal use and in second example, as you pointed out, how to resolve "..".

Yes, that sounds good to me, could you update your patch?

(Sorry for the long delay to answer, I missed your response)

#6 [ruby-core:57963] Updated by Eregon (Benoit Daloze) about 4 years ago

  • Assignee changed from zzak (Zachary Scott) to Eregon (Benoit Daloze)

This is better.
There is a typo "exapnd_path" and I would avoid references to your specific machine and Rails but use something more neutral. I will commit your patch with a couple changes.
Dir.pwd is also subject to change, so a static reference like FILE might be better.

Thank you for your contribution!

#7 Updated by Eregon (Benoit Daloze) about 4 years ago

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

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


  • file.c (File#expand_path): [DOC] improve documentation of File#expand_path. Based on patch by Prathamesh Sonpatki. [Bug #9002]

Also available in: Atom PDF