Skip to content
This repository
tag: v3.0.4.rc1
Fetching contributors…

Cannot retrieve contributors at this time

file 29 lines (27 sloc) 1.072 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29
require 'active_support/core_ext/module/deprecation'
require 'active_support/core_ext/module/aliasing'
require 'active_support/core_ext/array/extract_options'

module ActiveSupport
  class << Deprecation
    # Declare that a method has been deprecated.
    def deprecate_methods(target_module, *method_names)
      options = method_names.extract_options!
      method_names += options.keys

      method_names.each do |method_name|
        target_module.alias_method_chain(method_name, :deprecation) do |target, punctuation|
          target_module.module_eval(<<-end_eval, __FILE__, __LINE__ + 1)
def #{target}_with_deprecation#{punctuation}(*args, &block)
::ActiveSupport::Deprecation.warn(
::ActiveSupport::Deprecation.deprecated_method_warning(
:#{method_name},
#{options[method_name].inspect}),
caller
)
send(:#{target}_without_deprecation#{punctuation}, *args, &block)
end
end_eval
        end
      end
    end
  end
end
Something went wrong with that request. Please try again.