Flowdock
deprecate(*method_names, deprecator: nil, **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

Show source
Register or log in to add new notes.