From: Logan Capaldo Date: 2007-08-27T12:30:22+09:00 Subject: Re: how to check for block in an evaled method? On 8/26/07, Nasir Khan wrote: > > I get that. But the question is, is there a way to check for a block and > then yield in a defined method, as was my naive intention? > Stage 1) Upgrade to ruby 1.9 or later. 2) define_method(:foo) { |arg, &block| if block then block.call else puts arg } Alternative route is to use string eval. > > Thanks > Nasir >