From: Alex Fenton Date: 2007-06-11T18:00:30+09:00 Subject: Re: Relative/absolute url parsing Michel ( Dagnan ) wrote: > Hi! > > I have to collect urls from html files, I to transform relative urls to > absolute, I have to handle for example url beginning with '../' and > './', which is kind of ennoying :D (my head hurts because of the > debugging process) Not sure, but perhaps the standard library will do what you want? Assuming that this_page is the URL of the page you're scraping links from and '../qux' is the link URL you want to absolutise: SCIPIUS:~ alex$ irb irb(main):001:0> require 'uri' => true irb(main):002:0> this_page = URI.parse('http://www.abc.org/foo/bar/baz') => # irb(main):003:0> this_page.merge('../qux') => # alex