class Protocol::HTTP::Reference

def with(path: nil, parameters: nil, fragment: @fragment, pop: false, merge: true)

@argument merge [Boolean] If the parameters are specified, merge them with the existing parameters.
@argument pop [Boolean] If the path contains a trailing filename, pop the last component of the path before appending the new path.
@argument fragment [String] Set the fragment to this value.
@argument parameters [Hash] Append the parameters to this reference.
@argument path [String] Append the string to this reference similar to `File.join`.
Update the reference with the given path, parameters and fragment.
def with(path: nil, parameters: nil, fragment: @fragment, pop: false, merge: true)
	if @parameters
		if parameters and merge
			parameters = @parameters.merge(parameters)
		else
			parameters = @parameters
		end
	end
	
	if @query and !merge
		query = nil
	else
		query = @query
	end
	
	if path
		path = expand_path(@path, path, pop)
	else
		path = @path
	end
	
	self.class.new(path, query, fragment, parameters)
end