Skip to content

Instantly share code, notes, and snippets.

@odd-poet
Created February 9, 2012 02:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save odd-poet/1776598 to your computer and use it in GitHub Desktop.
Save odd-poet/1776598 to your computer and use it in GitHub Desktop.
deprecated : (in refactory ruby ed.)
class Module
def deprecate(methodName, &block)
module_eval <<-END
alias_method :deprecated_#{methodName}, :#{methodName}
def #{methodName}(*args, &block)
$stderr.puts "Warning: calling deprecated method #{self}.#{methodName}."
deprecated_#{methodName}(*args, &block)
end
END
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment