Skip to content
Newer
Older
100644 20 lines (15 sloc) 500 Bytes
04d6ebb @lest refactor RAILS_CACHE deprecation
lest authored Jan 19, 2012
1 require 'active_support/deprecation/proxy_wrappers'
6f8159c @kennyj Deprecate RAILS_CACHE constant.
kennyj authored Jan 18, 2012
2
3 module Rails
04d6ebb @lest refactor RAILS_CACHE deprecation
lest authored Jan 18, 2012
4 class DeprecatedConstant < ActiveSupport::Deprecation::DeprecatedConstantProxy
5 def self.deprecate(old, current)
88d578a @steveklabnik Remove 'assigned but unused variable' warning
steveklabnik authored Sep 18, 2012
6 # double assignment is used to avoid "assigned but unused variable" warning
7 constant = constant = new(old, current)
6f8159c @kennyj Deprecate RAILS_CACHE constant.
kennyj authored Jan 17, 2012
8 eval "::#{old} = constant"
9 end
10
04d6ebb @lest refactor RAILS_CACHE deprecation
lest authored Jan 18, 2012
11 private
6f8159c @kennyj Deprecate RAILS_CACHE constant.
kennyj authored Jan 17, 2012
12
04d6ebb @lest refactor RAILS_CACHE deprecation
lest authored Jan 18, 2012
13 def target
14 ::Kernel.eval @new_const.to_s
6f8159c @kennyj Deprecate RAILS_CACHE constant.
kennyj authored Jan 17, 2012
15 end
16 end
17
04d6ebb @lest refactor RAILS_CACHE deprecation
lest authored Jan 18, 2012
18 DeprecatedConstant.deprecate('RAILS_CACHE', '::Rails.cache')
6f8159c @kennyj Deprecate RAILS_CACHE constant.
kennyj authored Jan 17, 2012
19 end
Something went wrong with that request. Please try again.