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

20 lines
500 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)
# double assignment is used to avoid "assigned but unused variable" warning
constant = 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