2015-09-24から1日間の記事一覧

Ruby で include と継承した場合の super の優先順位

include と継承した場合、どちらが優先的に調べるのか試してみた。 [コード] module M def homu p "M#homu" end end class Base def homu p "Base#homu" end end class X < Base include M def homu p "X#homu" super end end X.new.homu [出力] "X#homu" "M…