Last active
August 7, 2016 03:18
-
-
Save shakemurasan/4174fd3471feaa89c0dec1ce0ad8856f to your computer and use it in GitHub Desktop.
メタプログラミングRuby 第2版 P33 のサンプルコード+α
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 M1 | |
end | |
module M2 | |
include M1 | |
end | |
module M3 | |
prepend M1 | |
include M2 | |
end | |
p M1.ancestors # [M1] | |
p M1.included_modules # [] | |
p M2.ancestors # [M2, M1] | |
p M2.included_modules # [M1] | |
p M3.ancestors # [M1, M3, M2] | |
p M3.included_modules # [M1, M2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@yasaichi 👍