Ruby 1.9.2 リファレンスマニュアル > ライブラリ一覧 > uriライブラリ > URI::Genericクラス > route_to

instance method URI::Generic#route_to

route_to(dst) -> URI::Generic

自身から dst への相対パスを返します。

[PARAM] dst:
URI を文字列かURIオブジェクトで与えます。

例:

require 'uri'
p URI.parse('http://www.ruby-lang.org/').route_to('http://www.ruby-lang.org/en/raa.html')

#=> #<URI::Generic:0x20100198 URL:en/raa.html>