Last active
October 16, 2016 06:38
-
-
Save kodaitakahashi/6831894b699f1c00332b386327a25a98 to your computer and use it in GitHub Desktop.
includeの説明
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 hoge | |
puts 'hoge' | |
end | |
end | |
class C | |
include M | |
end | |
a = C.new | |
a.hoge # => hoge |
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 hoge | |
puts 'hoge' | |
end | |
end | |
class C | |
include M | |
end | |
C.ancestors #=> => [C, M, Object, PP::ObjectMixin, Kernel, BasicObject] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment