Module: Mongoid::Deprecable Private
- Included in:
- Mongoid
- Defined in:
- lib/mongoid/deprecable.rb
Overview
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Adds ability to declare Mongoid-specific deprecations.
Instance Method Summary collapse
-
#deprecate(target_module, *method_descriptors) ⇒ Object
private
Declares method(s) as deprecated.
-
#deprecation_warning(id, warning, callstack = nil) ⇒ Object
private
Emits a warning using the current deprecator.
-
#deprecator ⇒ Object
private
A Mongoid::Deprecation instance to use for reporting deprecations.
-
#reset_deprecation_warnings! ⇒ Object
private
Resets all deprecation warnings.
Instance Method Details
#deprecate(target_module, *method_descriptors) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Declares method(s) as deprecated.
50 51 52 |
# File 'lib/mongoid/deprecable.rb', line 50 def deprecate(target_module, *method_descriptors) deprecator.deprecate_methods(target_module, *method_descriptors) end |
#deprecation_warning(id, warning, callstack = nil) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Emits a warning using the current deprecator. If the given warning (as
identified by id) has already been issued previously, this is a no-op.
26 27 28 29 30 31 |
# File 'lib/mongoid/deprecable.rb', line 26 def deprecation_warning(id, warning, callstack = nil) site = callstack&.first deprecation_warning_guard(id, site ? "#{site.path}:#{site.lineno}" : nil) do deprecator.warn(warning, callstack) end end |
#deprecator ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
A Mongoid::Deprecation instance to use for reporting deprecations
11 12 13 |
# File 'lib/mongoid/deprecable.rb', line 11 def deprecator @deprecator ||= Mongoid::Deprecation.new end |
#reset_deprecation_warnings! ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Resets all deprecation warnings. For use in tests.
16 17 18 |
# File 'lib/mongoid/deprecable.rb', line 16 def reset_deprecation_warnings! DEPRECATION_WARNING_MUTEX.synchronize { @deprecation_warnings = {} } end |