You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: rubygems_version_manager.rb
    path of file: ./repos/rubygems/bundler/spec/support
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require "pathname"
require_relative "helpers"
require_relative "path"

class RubygemsVersionManager
  include Spec::Helpers
  include Spec::Path

  def initialize(source)
    @source = source
  end

  def switch
    return if use_system?

    assert_system_features_not_loaded!

    switch_local_copy
    
  def assert_system_features_not_loaded!
    at_exit do
      rubylibdir = RbConfig::CONFIG["rubylibdir"]

      rubygems_path = rubylibdir + "/rubygems"
      rubygems_default_path = rubygems_path + "/defaults"

      bundler_path = rubylibdir + "/bundler"

      bad_loaded_features = $LOADED_FEATURES.select do |loaded_feature|
        (loaded_feature.start_with?(rubygems_path) && !loaded_feature.start_with?(rubygems_default_path)) ||
          loaded_feature.start_with?(bundler_path)
      end

      errors = if bad_loaded_features.any?
        all_commands_output + "the following features were incorrectly loaded:\n#{bad_loaded_features.join("\n")}"
      end

      raise errors if errors
    end