module Deprecation::Notifier::ClassMethods

Public Instance Methods

deprecate(*args) click to toggle source
# File lib/deprecation/notifier.rb, line 22
def deprecate(*args)
  return if defined?(Rails) && Rails.env.production?

  if args.size == 0 || args.first.is_a?(Hash)
    deprecate_class(*args)
  else
    deprecate_method(*args)
  end
end

Private Instance Methods

deprecate_class(options = {}) click to toggle source
# File lib/deprecation/notifier.rb, line 34
def deprecate_class(options = {})
  Deprecation::Notifier.__deprecation_logger__(self.class.name, nil, options)
end
deprecate_method(method_name, options = {}) click to toggle source
# File lib/deprecation/notifier.rb, line 38
def deprecate_method(method_name, options = {})
  method = instance_method(method_name)
  define_method(method_name) do |*args, &block|
    Deprecation::Notifier.__deprecation_logger__(self.class.name, method_name.to_s, options)
    method.bind(self).(*args, &block)
  end
end