To mark deprecated code in Ruby simply add a comment to the rdoc and call the Kernel#warn method. For example:
class Foo
# DEPRECATED: Please use useful instead.
def useless
warn "[DEPRECATION] `useless` is deprecated. Please use `useful` instead."
useful
end
def useful
# ...
end
endIf you’re using Yard instead of rdoc, your doc comment should look like this:
# @deprecated Please use {#useful} insteadAlso, don’t forget to remove the deprecated method in some future release.
You can use HTML tags for formatting. Wrap code in <code> tags and multiple lines of code in <pre><code> tags.