Created
August 6, 2014 16:40
-
-
Save rintaun/a868ae25bbfe7ae150bb to your computer and use it in GitHub Desktop.
This file contains 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
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