Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
# Original definition
class Whatever
def initialize
end
end
# Redefinition
class Whatever
alias_method :old_initialize, :initialize
def initialize(*args, &block)
puts "Initializing #{self.class}"
old_initialize(*args, &block)
end
end
Whatever.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment