Created
October 29, 2009 16:44
-
-
Save al2o3cr/221585 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 Outer | |
module M | |
def foo | |
if self.class.superclass.instance_methods.include?('foo') | |
super | |
else | |
puts 'module foo' | |
end | |
end | |
end | |
end | |
class A | |
def foo | |
puts 'Overridden foo' | |
end | |
end | |
class B < A | |
include Outer::M | |
end | |
# this works | |
B.new.foo | |
# this blows up with a 'superclass not found' error | |
foo_method = B.new.method('foo') | |
foo_method.call |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment