Code 1:
-------
module Mod
  def hello
    "Hello from Mod.\n"
  end
end
class Klass
  def hello
    "Hello from Klass.\n"
  end
end

k = Klass.new
p k.hello         #=> "Hello from Klass.\n"
k.extend(Mod)
p k.hello         #=> "Hello from Mod.\n"

Code 2:
--------
module Mod
  def hello
    "Hello from Mod.\n"
  end
end
class Klass
  include Mod
  def hello
    "Hello from Klass.\n"
  end
end
k = Klass.new
p k.hello         #=> "Hello from Klass.\n"
k.extend(Mod)
p k.hello         #=> "Hello from Klass.\n"

Why last k.hello  is  "Hello from Klass" Not "Hello from Mod"? After
Klass mixin with Mod, I am extending k object to include Mod so k's
metaclass methods now point to Mod methods.. right? they should get
called first before Klass instance methods if I am thinking right.
-- 
Posted via http://www.ruby-forum.com/.