Skip to content

Instantly share code, notes, and snippets.

@kodaitakahashi
Last active October 16, 2016 06:38
Show Gist options
  • Save kodaitakahashi/6831894b699f1c00332b386327a25a98 to your computer and use it in GitHub Desktop.
Save kodaitakahashi/6831894b699f1c00332b386327a25a98 to your computer and use it in GitHub Desktop.
includeの説明
module M
def hoge
puts 'hoge'
end
end
class C
include M
end
a = C.new
a.hoge # => hoge
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