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

19 lines
407 B
Ruby
Raw Normal View History

require 'active_support/deprecation/proxy_wrappers'
2012-01-17 11:53:09 -05:00
module Rails
class DeprecatedConstant < ActiveSupport::Deprecation::DeprecatedConstantProxy
def self.deprecate(old, current)
constant = new(old, current)
2012-01-17 11:53:09 -05:00
eval "::#{old} = constant"
end
private
2012-01-17 11:53:09 -05:00
def target
::Kernel.eval @new_const.to_s
2012-01-17 11:53:09 -05:00
end
end
DeprecatedConstant.deprecate('RAILS_CACHE', '::Rails.cache')
2012-01-17 11:53:09 -05:00
end