module Aws::Deprecations

def deprecated(method, options = {})

Options Hash: (**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
    "#################### DEPRECATION WARNING ####################\n"\
    "Called deprecated method `#{method}` of #{self}."\
    "#{" Use `#{options[:use]}` instead.\n" if options[:use]}"\
    "#{"Method `#{method}` will be removed in #{options[:version]}."\
      if options[:version]}"\
    "\n#############################################################"
  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