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: doctor.rb
    path of file: ./repos/rubygems/lib/rubygems
    
    the code of the file until where you have to start completion: # frozen_string_literal: true

require_relative "../rubygems"
require_relative "user_interaction"

##
# Cleans up after a partially-failed uninstall or for an invalid
# Gem::Specification.
#
# If a specification was removed by hand this will remove any remaining file
    
  def doctor
    @orig_home = Gem.dir
    @orig_path = Gem.path

    say "Checking #{@gem_repository}"

    Gem.use_paths @gem_repository.to_s

    unless gem_repository?
      say "This directory does not appear to be a RubyGems repository, " \
          "skipping"
      say
      return
    end

    doctor_children

    say
  ensure
    Gem.use_paths @orig_home, *@orig_path
  end