1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/railties/lib/rails/deprecation.rb
2012-09-18 16:53:36 +03:00

19 lines
500 B
Ruby

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