This can also be done using File.split / dirname /
basename:File.dirname "http://foo.com/bar/stuff.html"
#=> "http://foo.com/bar"File.basename "http://foo.com/bar/stuff.html"
#=> "stuff.html"File.split "http://foo.com/bar/stuff.html"
#=> ["http://foo.com/bar", "stuff.html"]File.join(
File.dirname("http://foo.com/bar/doc.html"\),
"relative_link.html" )
···
# => "http://foo.com/bar/relative_link.html"
Though that probably breaks on Windows since it has
backslashes for
directory separators.
---------------------
Using WinXP Pro (but don't tell me friends) and it
worked like a champ. I tried it in irb and as a
script in a file and both of them worked well.
Thanks, didn't think to use this library on URL's.
-Joe
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around