-
-
Save drbrain/4c2f9700224b235e009a614d826b327c 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
$ ruby t.rb | |
-> P#m | |
-> C#m | |
-> I#m | |
D#m | |
<- I#m | |
<- C#m | |
<- P#m |
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 P | |
def m | |
puts '-> P#m' | |
super | |
puts '<- P#m' | |
end | |
end | |
module I | |
def m | |
puts '-> I#m' | |
super | |
puts '<- I#m' | |
end | |
end | |
class D | |
def m | |
puts ' D#m' | |
end | |
end | |
class C < D | |
prepend P | |
include I | |
def m | |
puts '-> C#m' | |
super | |
puts '<- C#m' | |
end | |
end | |
C.new.m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment