al2o3cr (owner)

Revisions

gist: 221585 Download_button fork
public
Public Clone URL: git://gist.github.com/221585.git
Embed All Files: show embed
Text only #
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
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