Thank you. The patch was applied except the last sentence.

On 6/20/09 7:58 PM, Marc-Andre Lafortune wrote:
> If a block is specified, it is used as the method body. This block
> is evaluated using <code>instance_eval</code>.

define_singleton_method just define a method into the singleton class.
It does not use instance_eval. So it works differently from instance_eval.

module M
  obj = Object.new
  obj.instance_eval do
    T = Class.new
    p T.name #=> nil
  end
  obj.define_singleton_method(:a) do
    T = Class.new
    p T.name #=> M::T
  end
  obj.a
end




-- Yugui <yugui / yugui.jp>