Hi,

At Tue, 15 Jun 2004 18:48:34 +0900,
Csaba Henk wrote in [ruby-talk:103654]:
> class << foo
> end

This singleton class has no effect.

> foo.send(:define_method,:bar,q)
>  => NoMethodError: undefined method `define_method' for #<Object:0x401a2614>
> 
> That is, the singleton class is created, but the value of the variable foo
> (be it anything at this point) doesn't behave as a class, but as the
> original foo.

Yes, foo itself doesn't change.  You need to call define_method
in the singleton class context.

  q = proc {:q}
  foo = Object.new
  class << foo; self; end.module_eval do
    define_method(:bar,q)
  end
  p foo.bar # => :q

-- 
Nobu Nakada