Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
includeとprependを使ったメソッド探索
module M1; end
module M2; end
class C
include M1
prepend M2
end
a = C.new
a.ancestors #=> [M2, C, M1, Object, PP::ObjectMixin, Kernel, BasicObject]
module M1
def hoge
puts 'M1'
end
end
module M2
def hoge
puts 'M2'
end
end
class C
include M1
prepend M2
end
a = C.new
a.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.