lib/dry/core/deprecations.rb
# Mark class-level method as deprecated
#
# @param [Symbol] old_name deprecated method
# @param [Symbol] new_name replacement (not required)
# @option [String] message optional deprecation message
Mark class-level method as deprecated
Mark class - level method as deprecated
def deprecate_class_method(old_name, new_name = nil, message: nil)
          full_msg = Deprecations.deprecated_name_message(
            "#{name}.#{old_name}",
            new_name ? "#{name}.#{new_name}" : nil,
            message
          )
          meth = new_name ? method(new_name) : method(old_name)
          singleton_class.instance_exec do
            undef_method old_name if method_defined?(old_name)
            define_method(old_name) do |*args, &block|
              warn("#{full_msg}\n#{STACK.()}")
              meth.call(*args, &block)
            end
          end
        end
def deprecate_class_method ( old_name , new_name = nil , message : nil ) full_msg = Deprecations . deprecated_name_message ( "#{name}.#{old_name}" , new_name ? "#{name}.#{new_name}" : nil , message ) meth = new_name ? method ( new_name ) : method ( old_name ) singleton_class . instance_exec do undef_method old_name if method_defined? ( old_name ) define_method ( old_name ) do | * args , & block | warn ( "#{full_msg}\n#{STACK.()}" ) meth . call ( * args , & block ) end end end
Mark class-level method as deprecated
Mark class - level method as deprecated
old_name
<not_specific>
new_name
<not_specific>
message
<not_specific>
<not_specific>
message optional deprecation message
message optional deprecation message