class Protocol::HTTP::Reference
def expand_path(base, relative, pop = true)
-
pop
(Boolean
) -- whether to remove the last path component of the base path, to conform to URI merging behaviour, as defined by RFC2396.
def expand_path(base, relative, pop = true) if relative.start_with? "/" return relative end path = split(base) # RFC2396 Section 5.2: # 6) a) All but the last segment of the base URI's path component is # copied to the buffer. In other words, any characters after the # last (right-most) slash character, if any, are excluded. path.pop if pop or path.last == "" parts = split(relative) # Absolute path: if path.first == "" expand_absolute_path(path, parts) else expand_relative_path(path, parts) end return path.join("/") end