From: transfire@... Date: 2006-06-15T04:27:15+09:00 Subject: Re: Why the lack of mixing-in support for Class methods? Joel VanderWerf wrote: > Why should the order of calling extend and adding methods matter? It > doesn't seem to in this example, but this is much simpler than > class_extension: It's a little more subtle than that, because it has to do with modules included in modules. irb(main):001:0> module M irb(main):002:1> def foo; p "FOO"; end irb(main):003:1> end => nil irb(main):004:0> module N irb(main):005:1> def bar; p "BAR"; end irb(main):006:1> end => nil irb(main):007:0> module O irb(main):008:1> def baz; p "BAZ"; end irb(main):009:1> end => nil irb(main):010:0> module M irb(main):011:1> include N irb(main):012:1> end => M irb(main):013:0> class C irb(main):014:1> extend M irb(main):015:1> end => C irb(main):016:0> C.foo "FOO" => nil irb(main):017:0> C.bar "BAR" => nil irb(main):018:0> module M irb(main):019:1> include O irb(main):020:1> end => M irb(main):021:0> C.baz NoMethodError: undefined method `baz' for C:Class from (irb):21 from :0 T.