Created
February 1, 2012 04:48
-
-
Save takaheraw/1715166 to your computer and use it in GitHub Desktop.
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 Book | |
def title(title) | |
puts title | |
end | |
def self.deprecate(old_method, new_method) | |
define_method(old_method) do |*args, &block| | |
warn "Warning: #{old_method}() is deprecated. Use #{new_method}()." | |
send(new_method, *args, &block) | |
end | |
end | |
deprecate :GetTitle, :title | |
end | |
b = Book.new | |
b.GetTitle("foo") | |
b.title("bar") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment