Last active
October 16, 2016 07:22
-
-
Save kodaitakahashi/4a85808855aa5944dfb965608510fa05 to your computer and use it in GitHub Desktop.
extendの説明
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 | |
extend M | |
end | |
C.hoge #=> hoge | |
C.ancestors #=>[C, Object, PP::ObjectMixin, Kernel, BasicObject] | |
a = C.new | |
a.hoge #=> NoMethodError: undefined method `hoge' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment