super.rb

Serge Balyuk, 05/27/2010 03:45 PM

Download (217 Bytes)

 
1
class Base
2
  def foo
3
    puts "bar"
4
  end
5
end
6

    
7
module Override
8
  def foo
9
    puts "override"
10
    super
11
  end
12
end
13

    
14

    
15
class A < Base
16
end
17

    
18
class B < A
19
end
20

    
21
B.send(:include, Override)
22
A.send(:include, Override)
23

    
24
B.new.foo