module Deprecated
Public Instance Methods
deprecated(name, replacement=nil)
click to toggle source
# File lib/capistrano/rack/deprecated.rb, line 11 def deprecated(name, replacement=nil) # Replace old method with a wrapped version old_name = :"#{name}_without_deprecation" alias_method old_name, name define_method(name) do |*args, &block| if replacement warn "[DEPRECATION]".bold.red + " `#{name}` is deprecated. Please use `#{replacement}` instead.".bold.blue else warn "[DEPRECATION]".bold.red + " `#{name}` is deprecated.".bold.blue end send old_name, *args, &block end end
deprecated_alias(name, replacement)
click to toggle source
# File lib/capistrano/rack/deprecated.rb, line 4 def deprecated_alias(name, replacement) define_method(name) do |*args, &block| warn "[DEPRECATION]".bold.red + " `#{name}` is deprecated. Please use `#{replacement}` instead.".bold.blue send replacement, *args, &block end end