module Aws::Deprecations
def deprecated(method, options = {})
(**options)
-
:version
(String
) -- The version that will remove the -
:use
(String
) -- The name of a method that should be used. -
:message
(String
) -- The warning message to issue
Parameters:
-
method
(Symbol
) -- The name of the deprecated method.
def deprecated(method, options = {}) deprecation_msg = options[:message] || begin msg = "#################### DEPRECATION WARNING ####################\n" msg << "Called deprecated method `#{method}` of #{self}." msg << " Use `#{options[:use]}` instead.\n" if options[:use] if options[:version] msg << "Method `#{method}` will be removed in #{options[:version]}." end msg << "\n#############################################################" msg end alias_method(:"deprecated_#{method}", method) warned = false # we only want to issue this warning once define_method(method) do |*args, &block| unless warned warned = true warn(deprecation_msg + "\n" + caller.join("\n")) end send("deprecated_#{method}", *args, &block) end end