# File nqxml/uri.rb, line 30 def URI.parse(uriString, relativeFilePathBase=nil) uriString =~ REGEX scheme, username, password, host, port, path, argString = $2, $4, $5, $6, $8, $9, $11 # Handle nil scheme as "raw" file name or URI like "file:foo/bar" if scheme == nil uriString = uriString[5 .. -1] if uriString =~ /^file:/ if relativeFilePathBase && uriString[0] != File::SEPARATOR uriString = File.join(relativeFilePathBase, uriString) end return URI.new('file', nil, nil, uriString) end # Unescape username and password, if present username = CGI::unescape(username) if username password = CGI::unescape(password) if password args = nil if argString # Turn args into a hash, unescaping keys and values as we go args = Hash.new() argString.split(/&/).each { | keyval | key, val = keyval.split(/=/) args[CGI::unescape(key)] = CGI::unescape(val) } end return URI.new(scheme, host, port, path, args, username, password) end