aboutsummaryrefslogblamecommitdiffstats
path: root/railties/lib/rails/deprecation.rb
blob: 89f54069e9e3ac02a72e14bac56720b70c38f802 (plain) (tree)
1
2
3
4
5
6
7
8
9
10
                                                   

            

                                                                                

                                                                                 


                                
           
 

                                   


       
                                                              
   
require 'active_support/deprecation/proxy_wrappers'

module Rails
  class DeprecatedConstant < ActiveSupport::Deprecation::DeprecatedConstantProxy
    def self.deprecate(old, current)
      # double assignment is used to avoid "assigned but unused variable" warning
      constant = constant = new(old, current)
      eval "::#{old} = constant"
    end

    private

    def target
      ::Kernel.eval @new_const.to_s
    end
  end

  DeprecatedConstant.deprecate('RAILS_CACHE', '::Rails.cache')
end