From: Avi Bryant Date: 2001-03-25T07:46:49+09:00 Subject: [ruby-talk:13179] Re: self in blocks used with tk methods On Sun, 25 Mar 2001, joel wrote: > How do the ruby tk methods arrange to have self refer to the object > being created, e.g.: > > TkLabel.new { p self } ==> returns and prints the new label object > > ...but: > > class Test > def initialize > yield > end > end > > Test.new { p self } ==> prints 'main' and returns the new Test > object class Test def initialize(&b) instance_eval b end end Test.new { p self }