Last active
August 29, 2015 13:56
-
-
Save benweint/8791007 to your computer and use it in GitHub Desktop.
Demonstration of behavior difference between Ruby 1.9.3 and 2.0+
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 A | |
def foo | |
puts "foo from A" | |
end | |
end | |
class B | |
include A | |
def foo | |
puts "foo from B" | |
super | |
end | |
end | |
class C < B | |
alias_method :orig_foo, :foo | |
def foo | |
puts "foo from C" | |
orig_foo | |
end | |
end | |
class B | |
alias_method :orig_foo, :foo | |
def foo | |
puts "foo from B (again)" | |
orig_foo | |
end | |
end | |
C.new.foo |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment