Use alias_method to preserve an existing method under another name before redefining the original. It is a private Module instance method and accepts symbols or strings, unlike the alias keyword’s bare-name syntax. section 13.2.3
Logging through a pass-through override
A String#reverse override can print a message, call the aliased original method, and retain its return value. The resulting output is a log line followed by the reversed string. section 13.2.3
class String
alias_method :__old_reverse__, :reverse
end
Compare alias_method :__old_reverse__, :reverse with the equivalent alias declaration for preserving the original implementation. section 13.2.3
