Skip to content

End of Life Ruby 3.0 has reached end of life and gets no more fixes. Switch to Ruby 4.0 →

instance method

URI::Generic#route_from

route_from(oth)

Args

oth

URI or String

Description

Calculates relative path from oth to self.

Usage

Example
require 'uri'

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