Create a gist now

Instantly share code, notes, and snippets.

@benweint /test.rb
Last active Aug 29, 2015

Demonstration of behavior difference between Ruby 1.9.3 and 2.0+
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