class Bundler::URI::Generic

def route_from0(oth)

:stopdoc:
def route_from0(oth)
  oth = parser.__send__(:convert_to_uri, oth)
  if self.relative?
    raise BadURIError,
      "relative Bundler::URI: #{self}"
  end
  if oth.relative?
    raise BadURIError,
      "relative Bundler::URI: #{oth}"
  end
  if self.scheme != oth.scheme
    return self, self.dup
  end
  rel = Bundler::URI::Generic.new(nil, # it is relative Bundler::URI
                         self.userinfo, self.host, self.port,
                         nil, self.path, self.opaque,
                         self.query, self.fragment, parser)
  if rel.userinfo != oth.userinfo ||
      rel.host.to_s.downcase != oth.host.to_s.downcase ||
      rel.port != oth.port
    if self.userinfo.nil? && self.host.nil?
      return self, self.dup
    end
    rel.set_port(nil) if rel.port == oth.default_port
    return rel, rel
  end
  rel.set_userinfo(nil)
  rel.set_host(nil)
  rel.set_port(nil)
  if rel.path && rel.path == oth.path
    rel.set_path('')
    rel.query = nil if rel.query == oth.query
    return rel, rel
  elsif rel.opaque && rel.opaque == oth.opaque
    rel.set_opaque('')
    rel.query = nil if rel.query == oth.query
    return rel, rel
  end
  # you can modify `rel', but can not `oth'.
  return oth, rel
end