Created
October 8, 2016 11:52
-
-
Save zedtux/f7177c8d49179d297f7dabf8049634a6 to your computer and use it in GitHub Desktop.
Deprecation method implementation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Module | |
def deprecate(old_method, new_method) | |
define_method(old_method) do |*args, &block| | |
warn "DEPRECATION WARNING: #{old_method} is deprecated in favour of #{new_method}. (called from #{caller.first})" | |
send(new_method, *args, &block) | |
end | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment