Forum: Ruby Confusion with some File::methods

Posted by Love U Ruby (my-ruby)
on 2013-01-29 05:18
Hi,


(a) How does absolute_path(file_nam) differ from
absolute_path(file_name[, dir_string] )?

(b) How does realdirpath(pathname) differ from realdirpath(pathname [,
dir_string]) ?

Could you please tell me the concept as asked above with a suitable
example?

Thanks,
Posted by Joel Pearson (virtuoso)
on 2013-01-30 16:53
It will use the present working directory unless you specify otherwise.

irb(main):001:0> File.absolute_path 'a.txt'
=> "C:/Users/Joel/a.txt"
irb(main):002:0> File.absolute_path 'a.txt', 'C:/Test/'
=> "C:/Test/a.txt"
irb(main):003:0>
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.