module DeprecationToolkit
def add_notify_behavior
def add_notify_behavior notify = ActiveSupport::Deprecation::DEFAULT_BEHAVIORS[:notify] each_deprecator do |deprecator| behaviors = deprecator.behavior unless behaviors.find { |behavior| behavior == notify } deprecator.behavior = (behaviors << notify) end end end
def attach_subscriber
def attach_subscriber Configuration.attach_to.each do |gem_name| DeprecationSubscriber.attach_to(gem_name) end end
def each_deprecator(&block)
def each_deprecator(&block) if defined?(Rails.application) && Rails.application.respond_to?(:deprecators) Rails.application.deprecators.each(&block) elsif ActiveSupport::Deprecation.respond_to?(:behavior) block.call(ActiveSupport::Deprecation) end end