Skip to content

Instantly share code, notes, and snippets.

@benweint
Last active August 29, 2015 13:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save benweint/8791007 to your computer and use it in GitHub Desktop.
Save benweint/8791007 to your computer and use it in GitHub Desktop.
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