From: Todd Wei Date: 2012-06-20T10:22:13+09:00 Subject: Re: Does ERB have recursive template support? Robert Klemme wrote in post #1065085: > > What exactly do you mean by "recursive templates"? Do you mean a > template which can present recursive structures such as trees? Or do > you want an ERB template to include itself? Both should be doable > since you can invoke arbitrary code. > > Kind regards > > robert My code generator will generate Java nested classes. The problem is the level of nesting can't be determined statically. So, the ideal case is I define a Java class template in ERB, which accepts binding variables as input parameter, and in the template, it can "call" itself with new bindings. Just like what does recursive function do. I'm not sure if i can achieve this with "invoke arbitrary code". For example, can I invoke the template itself with new bindings in the template? Could you give me an example? Thanks! -- Posted via http://www.ruby-forum.com/.