Sha256: e37e2a7e2039de485eaae804c63d40ee95ced3feadcd8e625e3531916ac01a9f

Contents?: true

Size: 1.05 KB

Versions: 322

Compression:

Stored size: 1.05 KB

Contents

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

Version data entries

322 entries across 278 versions & 28 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/activesupport-3.2.22.5/lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.22.5 lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.22.4 lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.22.3 lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.22.2 lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.22.1 lib/active_support/deprecation/method_wrappers.rb
classiccms-0.7.5 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/deprecation/method_wrappers.rb
classiccms-0.7.4 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/deprecation/method_wrappers.rb
classiccms-0.7.3 vendor/bundle/gems/activesupport-3.2.3/lib/active_support/deprecation/method_wrappers.rb
active_mailer-0.0.10 test/fixtures/dummyapp_rails_3.2/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.12/lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.22 lib/active_support/deprecation/method_wrappers.rb
judge-2.0.5 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.12/lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.21 lib/active_support/deprecation/method_wrappers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/deprecation/method_wrappers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/deprecation/method_wrappers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/2.1.0/gems/activesupport-3.2.18/lib/active_support/deprecation/method_wrappers.rb
apl-library-0.0.90 vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/deprecation/method_wrappers.rb
apl-library-0.0.90 vendor/bundle/ruby/1.9.1/gems/activesupport-3.2.18/lib/active_support/deprecation/method_wrappers.rb
apl-library-0.0.90 vendor/bundle/ruby/2.1.0/gems/apl-library-0.0.90/vendor/bundle/ruby/1.8/gems/activesupport-3.2.18/lib/active_support/deprecation/method_wrappers.rb
activesupport-3.2.20 lib/active_support/deprecation/method_wrappers.rb