sonic-pi

https://github.com/sonic-pi-net/sonic-pi

C++

Code. Music. Live.

Module#deprecate

deprecate :foo
  deprecate bar: 'message'
  deprecate :foo, :bar, baz: 'warning!', qux: 'gone!'

You can also use custom deprecator instance:

  deprecate :foo, deprecator: MyLib::Deprecator.new
  deprecate :foo, bar: "warning!", deprecator: MyLib::Deprecator.new

\Custom deprecators must respond to <tt>deprecation_warning(deprecated_method_name, message, caller_backtrace)</tt>
method where you can implement your custom warning behavior.

  class MyLib::Deprecator
    def deprecation_warning(deprecated_method_name, message, caller_backtrace = nil)
       message = "#{deprecated_method_name} is deprecated and will be removed from MyLibrary | #{message}"
       Kernel.warn message
    end
  end

Source | Google | Stack overflow

Edit

git clone [email protected]:sonic-pi-net/sonic-pi.git

cd sonic-pi

open app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/module/deprecation.rb

Contribute

# Make a new branch

git checkout -b -your-name--update-docs-Module-deprecate-for-pr


# Commit to git

git add app/server/ruby/vendor/activesupport-7.0.6/lib/active_support/core_ext/module/deprecation.rbgit commit -m "better docs for Module#deprecate"


# Open pull request

gem install hub # on a mac you can `brew install hub`

hub fork

git push <your name> -your-name--update-docs-Module-deprecate-for-pr

hub pull-request


# Celebrate!