module ActiveSupport::Deprecation::Reporting

def deprecated_method_warning(method_name, message = nil)

# => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (Optional message)"
deprecated_method_warning(:method_name, "Optional message")
# => "method_name is deprecated and will be removed from Rails #{deprecation_horizon} (use another_method instead)"
deprecated_method_warning(:method_name, :another_method)
# => "method_name is deprecated and will be removed from Rails #{deprecation_horizon}"
deprecated_method_warning(:method_name)

Outputs a deprecation warning message
def deprecated_method_warning(method_name, message = nil)
  warning = "#{method_name} is deprecated and will be removed from #{gem_name} #{deprecation_horizon}"
  case message
  when Symbol then "#{warning} (use #{message} instead)"
  when String then "#{warning} (#{message})"
  else warning
  end
end