Sha256: 4406f1b620abaa4d9b2eab7ee4b52765c163345cb07a630e441c510f42f8ce1e

Contents?: true

Size: 998 Bytes

Versions: 37

Compression:

Stored size: 998 Bytes

Contents

module ActiveAdmin
  module Deprecation
    module_function

    def warn(message, callstack = caller)
      ActiveSupport::Deprecation.warn "Active Admin: #{message}", callstack
    end

    # Deprecate a method.
    #
    # @param [Module] klass the Class or Module to deprecate the method on
    # @param [Symbol] method the method to deprecate
    # @param [String] message the message to display to the end user
    #
    # Example:
    #
    #     class MyClass
    #       def my_method
    #         # ...
    #       end
    #       ActiveAdmin::Deprecation.deprecate self, :my_method,
    #         "MyClass#my_method is being removed in the next release"
    #     end
    #
    def deprecate(klass, method, message)
      klass.send :define_method, "deprecated_#{method}", klass.instance_method(method)

      klass.send :define_method, method do |*args|
        ActiveAdmin::Deprecation.warn "#{message}", caller
        send "deprecated_#{method}", *args
      end
    end

  end
end

Version data entries

37 entries across 37 versions & 6 rubygems

Version Path
activeadmin-1.3.1 lib/active_admin/deprecation.rb
activeadmin-1.3.0 lib/active_admin/deprecation.rb
activeadmin-1.2.1 lib/active_admin/deprecation.rb
activeadmin_addons-1.1.2 vendor/bundle/ruby/2.3.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/deprecation.rb
activeadmin-1.2.0 lib/active_admin/deprecation.rb
activeadmin_addons-1.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.17.pre lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.16.pre lib/active_admin/deprecation.rb
activeadmin_addons-1.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/deprecation.rb
activeadmin_addons-1.0.1 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/deprecation.rb
activeadmin_addons-1.0.0 vendor/bundle/ruby/2.2.0/bundler/gems/activeadmin-a5a53c3f2b8f/lib/active_admin/deprecation.rb
activeadmin-1.1.0 lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.15.pre lib/active_admin/deprecation.rb
activeadmin-1.0.0 lib/active_admin/deprecation.rb
activeadmin-1.0.0.pre5 lib/active_admin/deprecation.rb
activeadmin-orac-1.0.0.pre4 lib/active_admin/deprecation.rb
activeadmin-orac-1.0.0 lib/active_admin/deprecation.rb
activeadmin-orac-1.0.0.pre.orac lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.14.pre lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.13.pre lib/active_admin/deprecation.rb