Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

instance method

URI::Generic#route_to

(::String oth) -> ::URI::Generic
route_to(oth)

Args

oth

URI or String

Description

Calculates relative path to oth from self.

Usage

Example
require 'uri'

uri = URI.parse('http://my.example.com')
uri.route_to('http://my.example.com/main.rbx?page=1')
#=> #<URI::Generic /main.rbx?page=1>
See also #route_from #scheme= #replace! #select also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0