Sha256: 0dfcc8506a1fd6920da6cc2281fb54b551762f97f5e8fab7af644fc7b7ad43c9

Contents?: true

Size: 1008 Bytes

Versions: 66

Compression:

Stored size: 1008 Bytes

Contents

module ActiveAdmin
  module Deprecation
    extend self

    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__
        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

66 entries across 66 versions & 4 rubygems

Version Path
lalala-4.0.0.dev.141 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.136 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.135 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.134 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.133 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.132 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.131 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.129 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.128 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.126 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.125 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.124 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.123 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.118 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.116 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.114 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.113 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.111 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.109 vendor/deps/active_admin/lib/active_admin/deprecation.rb
lalala-4.0.0.dev.107 vendor/deps/active_admin/lib/active_admin/deprecation.rb