def user=(new_user)
      if new_user && !new_user.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_user.class} into String."
      end
      @user = new_user ? new_user.to_str : nil

      # You can't have a nil user with a non-nil password
      if password != nil
        @user = EMPTY_STR if @user.nil?
      end

      # Reset dependent values
      remove_instance_variable(:@userinfo) if defined?(@userinfo)
      remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo)
      remove_instance_variable(:@authority) if defined?(@authority)
      remove_instance_variable(:@normalized_user) if defined?(@normalized_user)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
def user=(new_user)
      if new_user && !new_user.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_user.class} into String."
      end
      @user = new_user ? new_user.to_str : nil

      # You can't have a nil user with a non-nil password
      if password != nil
        @user = EMPTY_STR if @user.nil?
      end

      # Reset dependent values
      remove_instance_variable(:@userinfo) if defined?(@userinfo)
      remove_instance_variable(:@normalized_userinfo) if defined?(@normalized_userinfo)
      remove_instance_variable(:@authority) if defined?(@authority)
      remove_instance_variable(:@normalized_user) if defined?(@normalized_user)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
Sets the user component for this URI.

 @param [String, #to_str] new_user The new user component.