class Mongoid::Deprecation

Utility class for logging deprecation warnings.

Public Class Methods

new() click to toggle source
Calls superclass method
# File lib/mongoid/deprecation.rb, line 9
def initialize
  # Per change policy, deprecations will be removed in the next major version.
  deprecation_horizon = "#{Mongoid::VERSION.split('.').first.to_i + 1}.0".freeze
  gem_name = 'Mongoid'
  super(deprecation_horizon, gem_name)
end

Public Instance Methods

behavior() click to toggle source

Overrides default ActiveSupport::Deprecation behavior to use Mongoid’s logger.

@return [ Array<Proc> ] The deprecation behavior.

# File lib/mongoid/deprecation.rb, line 21
def behavior
  @behavior ||= Array(->(*args) {
    logger = Mongoid.logger
    logger.warn(args[0])
    logger.debug(args[1].join("\n  ")) if debug
  })
end