------ art_7410_10252724.1126482136142 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline > > One could capture the output by setting the default output to a > StringIO; this is similar to what I did in a previous solution. It is > rather easy to put together a simple, thread-safe version that does > this. Currently, the default is to capture the output as a string, but > a webserver-related use would probably just send the output directly > to the browser *as it is being output*, rather than building the > string and sending it all at once. > > I don't see this as being about adding "magic" to the implementation. > If you are of the mindset that the template is concatting to a string, > the puts idea doesn't make sense; but if you see it as printing to an > output stream (with the whole _erbout thing just being an > implementation issue), then the lack of a working print/puts is what > doesn't make sense. > > Indeed, their are certain efficiencies not having to pre-generate all output before transmission. Think file downloads, dynamic image generation etc. As a general tool, being able to reassign STDOUT/STDIN/STDERR to an IO would be very powerfull. From my perspective, ERB's main usage is as a dynamic web page generator means that its natural to think of all program output going 'to a web browser' rather than to a console. ------ art_7410_10252724.1126482136142--