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: helpers.rb
    path of file: ./repos/stackneveroverflow/vendor/bundle/ruby/2.3.0/gems/devise-4.3.0/test/support
    
    the code of the file until where you have to start completion: require 'active_support/test_case'

class ActiveSup
    
  def swap(object, new_values)
    old_values = {}
    new_values.each do |key, value|
      old_values[key] = object.send key
      object.send :"#{key}=", value
    end
    clear_cached_variables(new_values)
    yield
  ensure
    clear_cached_variables(new_values)
    old_values.each do |key, value|
      object.send :"#{key}=", value
    end
  end