Skip to content

Instantly share code, notes, and snippets.

@al2o3cr
Created October 29, 2009 16:44
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 al2o3cr/221585 to your computer and use it in GitHub Desktop.
Save al2o3cr/221585 to your computer and use it in GitHub Desktop.
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