instance method
URI::Generic#-
-(oth)
lib/uri/generic.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/uri/generic.rb, line 1274
def route_from(oth)
# you can modify `rel', but cannot `oth'.
begin
oth, rel = route_from0(oth)
rescue
raise $!.class, $!.message
end
if oth == rel
return rel
end
rel.set_path(route_from_path(oth.path, self.path))
if rel.path == './' && self.query
# "./?foo" -> "?foo"
rel.set_path('')
end
return rel
end
Alias of #route_from
Args
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>