godfat (owner)

Revisions

gist: 30606 Download_button fork
public
Description:
Kernel and IncludedModule
Public Clone URL: git://gist.github.com/30606.git
Embed All Files: show embed
Ruby #
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
# http://rubinius.lighthouseapp.com/projects/5089/tickets/729-kernel-and-includedmodule
 
module M
 def m
 end
end
 
module K
end
 
class C
 include K
end
 
module K
 include M
end
 
C.new.m # => undefined method
 
class D
 include K
end
 
D.new.m # => nil
C.new.m # => undefined method
 
Ruby #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
module M
 def m
 end
end
 
module Kernel
 include M
end
 
class C
end
 
C.new.m # => undefined method
 
class D
 include Kernel
end
 
D.new.m # => nil
C.new.m # => nil in Rubinius
# undefined method in MRI 1.8/1.9 and JRuby
 
Ruby #
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
30
31
32
module K
end
 
class O
  include K
end
 
class C < O
end
 
class D < O
end
 
module M
  def m
  end
end
 
module K
  include M
end
 
C.new.m # => undefined method
D.new.m # => undefined method
 
class D
  include K
end
 
D.new.m # => nil
C.new.m # => nil in Rubinius
# undefined method in MRI 1.8/1.9 and JRuby