Skip to content

Instantly share code, notes, and snippets.

@rintaun
Created August 6, 2014 16:40
Show Gist options
  • Save rintaun/a868ae25bbfe7ae150bb to your computer and use it in GitHub Desktop.
Save rintaun/a868ae25bbfe7ae150bb to your computer and use it in GitHub Desktop.
module SomeMethodsPlease
def self.included(klass)
klass.instance_eval do
alias_method :old_initialize, :initialize
def initialize
p "the new one"
old_initialize
end
end
end
end
class SomeTestingPlease
def initialize
p "the old one"
end
include SomeMethodsPlease
end
SomeTestingPlease.new
# => "the old one"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment