How can I convert a relative link in Mechanize to an absolute one?

absolute-path, hyperlink, mechanize, relative-url, ruby

Solution

You can just merge the page uri (which is always absolute) with the link uri:

page.uri.merge link.uri

Problem

Is there is a way to convert a Mechanize relative-link object to another one which contains the absolute URL. Mechanize must know the absolute link, because I can call the `click` method on relative links too.

Original source