def scheme=(new_scheme)
      if new_scheme && !new_scheme.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_scheme.class} into String."
      elsif new_scheme
        new_scheme = new_scheme.to_str
      end
      if new_scheme && new_scheme !~ /\A[a-z][a-z0-9\.\+\-]*\z/i
        raise InvalidURIError, "Invalid scheme format: #{new_scheme}"
      end
      @scheme = new_scheme
      @scheme = nil if @scheme.to_s.strip.empty?

      # Reset dependent values
      remove_instance_variable(:@normalized_scheme) if defined?(@normalized_scheme)
      remove_composite_values

      # Ensure we haven't created an invalid URI
      validate()
    end
def scheme=(new_scheme)
      if new_scheme && !new_scheme.respond_to?(:to_str)
        raise TypeError, "Can't convert #{new_scheme.class} into String."
      elsif new_scheme
        new_scheme = new_scheme.to_str
      end
      if new_scheme && new_scheme !~ /\A[a-z][a-z0-9\.\+\-]*\z/i
        raise InvalidURIError, "Invalid scheme format: #{new_scheme}"
      end
      @scheme = new_scheme
      @scheme = nil if @scheme.to_s.strip.empty?

      # Reset dependent values
      remove_instance_variable(:@normalized_scheme) if defined?(@normalized_scheme)
      remove_composite_values

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

 @param [String, #to_str] new_scheme The new scheme component.