Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 30 lines (27 sloc) 1.072 kB
727e9dc @jeremy Dice up ActiveSupport::Deprecation
jeremy authored
1 require 'active_support/core_ext/module/deprecation'
f28bd95 @jeremy Fix dependencies revealed by testing in isolation
jeremy authored
2 require 'active_support/core_ext/module/aliasing'
e7c08c1 @fxn method_wrappers.rb needs active_support/core_ext/array/extract_options
fxn authored
3 require 'active_support/core_ext/array/extract_options'
727e9dc @jeremy Dice up ActiveSupport::Deprecation
jeremy authored
4
5 module ActiveSupport
6 class << Deprecation
7 # Declare that a method has been deprecated.
8 def deprecate_methods(target_module, *method_names)
9 options = method_names.extract_options!
10 method_names += options.keys
11
12 method_names.each do |method_name|
13 target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation|
685a53a @jeremy Merge branch 'master' into cherry
jeremy authored
14 target_module.module_eval(<<-end_eval, __FILE__, __LINE__ + 1)
6b12d74 @jeremy Commented metaprogramming turned out to be noisier not clearer
jeremy authored
15 def #{target}_with_deprecation#{punctuation}(*args, &block)
16 ::ActiveSupport::Deprecation.warn(
17 ::ActiveSupport::Deprecation.deprecated_method_warning(
18 :#{method_name},
19 #{options[method_name].inspect}),
20 caller
21 )
22 send(:#{target}_without_deprecation#{punctuation}, *args, &block)
23 end
727e9dc @jeremy Dice up ActiveSupport::Deprecation
jeremy authored
24 end_eval
25 end
26 end
27 end
28 end
29 end
Something went wrong with that request. Please try again.