Skip to content

Instantly share code, notes, and snippets.

@zedtux
Created October 8, 2016 11:52
Show Gist options
  • Save zedtux/f7177c8d49179d297f7dabf8049634a6 to your computer and use it in GitHub Desktop.
Save zedtux/f7177c8d49179d297f7dabf8049634a6 to your computer and use it in GitHub Desktop.
Deprecation method implementation
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