From: Mark Hubbart Date: 2004-04-09T16:54:44+09:00 Subject: Re: 'nother question on erb/eruby On Apr 8, 2004, at 11:14 PM, Charles Comstock wrote: > Hmm, it's pretty general practice in all the other embedded languages > that use the <% %> style coding to be able to also print directly in > the language, ie sometimes it makes more sense. Is there a particular > reason the code generation places the puts before hand? I mean from > my reading of the way erb works it shouldn't be doing that? Anyone > have an explanation to this behavior? erb builds the page piece by piece as a string, then outputs it when done processing; anything #printed out along the way comes out first because the rest of the page gets printed out all at once at the end. You can see the script it builds by calling erb with the -x option. (strangely, the generated script doesn't output the string at the end, so the script will not run properly...) I think you are right... it doesn't make sense to me that erb should do it this way. If it's going to buffer it to a string, that makes sense; but I think it should override Kernel#print and #puts to concatenate to the buffer... --Mark