Re: eRB <%=

From: Rob S. [mailto:[email protected]]

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-talk/152909