Class: Mongoid::Deprecation
- Inherits:
-
ActiveSupport::Deprecation
- Object
- ActiveSupport::Deprecation
- Mongoid::Deprecation
- Defined in:
- lib/mongoid/deprecation.rb
Overview
Utility class for logging deprecation warnings.
Instance Method Summary collapse
-
#behavior ⇒ Array<Proc>
Overrides default ActiveSupport::Deprecation behavior to use Mongoid’s logger.
-
#initialize ⇒ Deprecation
constructor
A new instance of Deprecation.
Constructor Details
#initialize ⇒ Deprecation
Returns a new instance of Deprecation.
9 10 11 12 13 14 |
# 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 |
Instance Method Details
#behavior ⇒ Array<Proc>
Overrides default ActiveSupport::Deprecation behavior to use Mongoid’s logger.
21 22 23 24 25 26 27 |
# 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 |