instance method
deprecate
Ruby on Rails 4.2.9
Since v3.0.20Signature
deprecate(*method_names)
deprecate :foo
deprecate bar: 'message' deprecate :foo, :bar, baz: 'warning!', qux: 'gone!'
You can also use custom deprecator instance:
deprecate :foo, deprecator: MyLib::Deprecator.new deprecate :foo, bar: "warning!", deprecator: MyLib::Deprecator.new
Custom deprecators must respond to deprecation_warning(deprecated_method_name, message, caller_backtrace) method 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
Parameters
-
method_namesrest
Source
# File activesupport/lib/active_support/core_ext/module/deprecation.rb, line 20
def deprecate(*method_names)
ActiveSupport::Deprecation.deprecate_methods(self, *method_names)
end
Defined in activesupport/lib/active_support/core_ext/module/deprecation.rb line 20
· View on GitHub
· Improve this page
· Find usages on GitHub
Defined in Module