From: Logan Capaldo Date: 2006-08-03T22:53:07+09:00 Subject: Re: define_method vs eval "def ..." On Aug 3, 2006, at 9:45 AM, Tomasz Wegrzanowski wrote: > Hello, > > Just wondering, with eval "def ..." I can do: > eval "def #{tag}(*args, &blk) xml(:#{tag}, *args, &blk) end" > > Of course it would be nicer to do: > define_method(tag) {|*args,&blk|, xml(tag, *args, &blk) } > But that throws a parse error. > > Is there some way to define method that takes a block argument > without calling eval ? > Ruby 1.9 lets blocks take blocks like define_method(:meth) { |*args, &blk| ... } Currently theres no way to do it in 1.8 AFAIK. > -- > Tomasz Wegrzanowski [ http://t-a-w.blogspot.com/ ] >