Skip to content

Instantly share code, notes, and snippets.

@drbrain

drbrain/output Secret

Created August 3, 2016 00:43
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 drbrain/4c2f9700224b235e009a614d826b327c to your computer and use it in GitHub Desktop.
Save drbrain/4c2f9700224b235e009a614d826b327c to your computer and use it in GitHub Desktop.
$ ruby t.rb
-> P#m
-> C#m
-> I#m
D#m
<- I#m
<- C#m
<- P#m
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