method
deprecate
v7.2.3 -
Show latest stable
- Class:
Module
deprecate(*method_names, deprecator:, **options)public
deprecate :foo, deprecator: MyLib.deprecator deprecate :foo, bar: “warning!”, deprecator: MyLib.deprecator
A deprecator is typically an instance of ActiveSupport::Deprecation, but you can also pass any object that responds to deprecation_warning(deprecated_method_name, message, caller_backtrace) where you can implement your custom warning behavior.
class MyLib::Deprecator
def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil) message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}" Kernel.warn message end
end