diff options
Diffstat (limited to 'file.c')
-rw-r--r-- | file.c | 13 |
1 files changed, 12 insertions, 1 deletions
@@ -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 |