class Addressable::URI

def omit(*components)

Returns:
  • (Addressable::URI) - The URI with components omitted.

Parameters:
  • *components (Symbol) -- The components to be omitted.
def omit(*components)
  invalid_components = components - [
    :scheme, :user, :password, :userinfo, :host, :port, :authority,
    :path, :query, :fragment
  ]
  unless invalid_components.empty?
    raise ArgumentError,
      "Invalid component names: #{invalid_components.inspect}."
  end
  duplicated_uri = self.dup
  duplicated_uri.defer_validation do
    components.each do |component|
      duplicated_uri.send((component.to_s + "=").to_sym, nil)
    end
    duplicated_uri.user = duplicated_uri.normalized_user
  end
  duplicated_uri
end