summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-22 07:59:23 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-10-22 07:59:23 +0000
commit5b91ab1f2e55bbd2965e702830404fadd90043cd (patch)
treeda74914ef822956394d6009ddcf50d5fb197392d
parentf57c988e343a4d682d3a988127b0552dde3caf3e (diff)
* file.c (File#expand_path): [DOC] improve documentation of File#expand_path.
Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43386 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog5
-rw-r--r--file.c13
2 files changed, 17 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e10de3715..d9c9fe9ecf 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+Tue Oct 22 16:57:48 2013 Benoit Daloze <eregontp@gmail.com>
+
+ * file.c (File#expand_path): [DOC] improve documentation of File#expand_path.
+ Based on patch by Prathamesh Sonpatki. [ruby-core:57734] [Bug #9002]
+
Tue Oct 22 15:59:51 2013 Nobuyoshi Nakada <nobu@ruby-lang.org>
* dir.c (glob_helper): don't skip current directories if FNM_DOTMATCH
diff --git a/file.c b/file.c
index acbaa5c5f4..a29de3b1ab 100644
--- a/file.c
+++ b/file.c
@@ -3432,7 +3432,18 @@ rb_file_expand_path_fast(VALUE fname, VALUE dname)
* user's home directory.
*
* File.expand_path("~oracle/bin") #=> "/home/oracle/bin"
- * File.expand_path("../../bin", "/tmp/x") #=> "/bin"
+ *
+ * A simple example of using <i>dir_string</i> is as follows.
+ * File.expand_path("ruby", "/usr/bin") #=> "/usr/bin/ruby"
+ *
+ * A more complex example which also resolves parent directory is as follows.
+ * Suppose we are in bin/mygem and want the absolute path of lib/mygem.rb.
+ *
+ * File.expand_path("../../lib/mygem.rb", __FILE__)
+ * #=> ".../path/to/project/lib/mygem.rb"
+ *
+ * So first it resolves the parent of __FILE__, that is bin/, then go to the
+ * parent, the root of the project and appends +lib/mygem.rb+.
*/
VALUE