Skip to content

Instantly share code, notes, and snippets.

@kodaitakahashi kodaitakahashi/extend.rb
Last active Oct 16, 2016

Embed
What would you like to do?
extendの説明
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
You can’t perform that action at this time.