class Foo
  def barer
   bar.new
  end
 end
 module M
  class Bar
  end
  def bar() Bar end
 end
 foo=Foo.new
 foo.extend M
 foo.barer   #=> #<Foo::Bar:0x2940eb8>