class Addressable::URI

def password=(new_password)

Parameters:
  • new_password (String, #to_str) -- The new password component.
def password=(new_password)
  if new_password && !new_password.respond_to?(:to_str)
    raise TypeError, "Can't convert #{new_password.class} into String."
  end
  @password = new_password ? new_password.to_str : nil
  # You can't have a nil user with a non-nil password
  @password ||= nil
  @user ||= nil
  if @password != nil
    @user = EMPTYSTR if @user.nil?
  end
  # Reset dependant values
  @userinfo = nil
  @normalized_userinfo = nil
  @authority = nil
  @normalized_password = nil
  @uri_string = nil
  @hash = nil
  # Ensure we haven't created an invalid URI
  validate()
end