From: Paul Brannan Date: 2008-01-01T22:45:35+09:00 Subject: Re: def if ; end - basically impossible? Giles Bowkett wrote: > generating_code(ForSomething) do > if variable != some_condition > do :stuff > else > do(:other => stuff) > end > end The only way I know to make this work is to use parsetree or nodewrap to build a custom parser for the block. I've tinkered with doing this, but it always turns out too hard for the user (actually, everything's easy except for how Ruby handles local variables -- I think need to build an intermediate representation for the Ruby code that can be easily transformed). The solution you came up with is probably cleaner, at least for the time being. Paul