123456789_123456789_123456789_123456789_123456789_

Module: Mongoid::Config::DeprecatedOptions

Relationships & Source Files
Extension / Inclusion / Inheritance Descendants
Included In:
Defined in: lib/mongoid/config.rb

Overview

Wraps configuration options that have been deprecated so that assigning them emits a deprecation warning. OPTIONS is intentionally empty when no options are currently deprecated; it is populated as options are retired, at which point this module rewrites their setters to warn.

Constant Summary

Class Method Summary

Class Method Details

.prepended(klass)

[ GitHub ]

  
# File 'lib/mongoid/config.rb', line 559

def self.prepended(klass)
  klass.class_eval do
    OPTIONS.each do |option|
      alias_method :"#{option}_without_deprecation=", :"#{option}="

      define_method(:"#{option}=") do |value|
        Mongoid::Warnings.send(:"warn_#{option}_deprecated")
        send(:"#{option}_without_deprecation=", value)
      end
    end
  end
end