[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: eRB <%=

Gavin Kistner

9/14/2006 4:31:00 AM

From: Rob Sanheim [mailto:rsanheim@gmail.com]
> One thing I've often wondered is how do you output from w/i a "non
> output" block...ie in java scriptlets these are equivalent:
>
> <% out.println("hi") %>
> <%= "hi" %>
>
> With ERB I've had some (admittedly rare) cases where this would be
> useful. Is it possible?

As others have noted, you can concatenate to the _erbout string variable.
You can also name this variable whatever you like (4th param to the ERB initializer).
You can also patch ERB so that print/puts/p all do what you might expect:

http://blade.nagaokaut.ac.jp/cgi-bin/scat.rb/ruby/ruby-t...