Sha256: 23876f1620dceffe34a230b4eff822d2f308caeaf5874bbad75ac91d12162222

Contents?: true

Size: 1014 Bytes

Versions: 12

Compression:

Stored size: 1014 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.class_eval <<-EOC, __FILE__, __LINE__ + 1
        alias_method :deprecated_#{method}, :#{method}
        def #{method}(*args)
          ActiveAdmin::Deprecation.warn('#{message}', caller)
          send(:deprecated_#{method}, *args)
        end
      EOC
    end

  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
activeadmin-0.6.6 lib/active_admin/deprecation.rb
activeadmin-0.6.5 lib/active_admin/deprecation.rb
activeadmin-0.6.4 lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.4.pre lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.3.pre lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.2.pre lib/active_admin/deprecation.rb
activeadmin-0.6.3 lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.1.pre lib/active_admin/deprecation.rb
yousty-activeadmin-1.0.0.pre lib/active_admin/deprecation.rb
activeadmin-0.6.2 lib/active_admin/deprecation.rb
activeadmin-0.6.1 lib/active_admin/deprecation.rb
aa-rails4-0.6.0 lib/active_admin/deprecation.rb