2013-03-07から1日間の記事一覧
Module#include クラスAがモジュールMをincludeすると、メソッドの探索順は A → M → …のようになる。 つまり、モジュールMはクラスAの親クラス側に差し込まれる。 module M def hello puts "M hello" end end class A include M def hello super puts "A hel…
Module#include クラスAがモジュールMをincludeすると、メソッドの探索順は A → M → …のようになる。 つまり、モジュールMはクラスAの親クラス側に差し込まれる。 module M def hello puts "M hello" end end class A include M def hello super puts "A hel…