Skip to content

Instantly share code, notes, and snippets.

@takaheraw
Created February 1, 2012 04:48
Show Gist options
  • Save takaheraw/1715166 to your computer and use it in GitHub Desktop.
Save takaheraw/1715166 to your computer and use it in GitHub Desktop.
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