Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

Demonstration of behavior difference between Ruby 1.9.3 and 2.0+

View test.rb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
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
Something went wrong with that request. Please try again.