From: Hidetoshi NAGAI Date: 2005-12-02T16:51:52+09:00 Subject: Re: Ruby/Tk: pack() with block doesn't work From: Hidetoshi NAGAI Subject: Re: Ruby/Tk: pack() with block doesn't work Date: Fri, 2 Dec 2005 16:31:20 +0900 Message-ID: <20051202.163115.59666027.nagai@ai.kyutech.ac.jp> > 'pack' method doesn't accept a block. > So, I think that it is a bug in the Pickaxe example. If use the following definition, 'pack' can accept a block. ;-) ----------------------------------------------------------- class TkWindow alias _pack pack def pack(h=nil, &b) _pack(h) if b dummy_obj = Object.new dummy_obj.instance_variable_set('@w', self) class << dummy_obj def method_missing(id, val) @w.pack(id=>val) end end dummy_obj.instance_eval(&b) end self end end ----------------------------------------------------------- -- Hidetoshi NAGAI (nagai@ai.kyutech.ac.jp)