Created
August 25, 2011 14:17
-
-
Save kohsuke/1170770 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
module M | |
def self.included(cls) | |
super(cls) | |
puts "xyz" | |
if cls.class == Module | |
cls.extend(M) | |
else | |
# Quote of the day | |
# Kohsuke: "Did I just avoid the harm of eval?" | |
# NaHi: "No, this is actually worse" | |
cls.module_eval do | |
def self.inherited(p) | |
puts "#{self} was subtyped by #{p}" | |
end | |
end | |
end | |
end | |
end | |
class Alice | |
include M | |
end | |
class Bob < Alice | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment