"David Heinemeier Hansson" <david / loudthinking.com> wrote in message
news:28220EB3-7F2D-11D8-AC42-000A958E6254 / loudthinking.com...
> >> ....code template in plain text...
> >> <% code_lines.each { |line| print line } %>
> >> ....more plain text code...
> >
> > Try this:
> >
> > <%  code_lines.each do |line| %>
> > <%=   line %>
> > <%  end %>
>
> Alternatively, you can do:
> <%= code_lines.join %>
>
> Or, if your example was simplified and you really need to do something
> with each line, then for example:
>
> <%= code_lines.collect { |line| line.capitalize }.join %>

Thanks, those are good tips that I'll definitely use!

>
> But it's not as logical as could be. Wouldn't it be possible to point
> STDOUT somewhere else and insert it correctly? Perhaps ERb/eRuby
> already allows for this and we just don't know :).

Indeed, that would be a very nice feature! I've been looking around the Net
a bit for a bit in-depth english tutorials on ERb (and eRuby), but I haven't
found any yet. Sadly, I don't read japanese (like a lot of the world's
myriad of languages... I read my native norwegian pretty well, but obviously
that doesn't help much :-P)

Thanks for your help!

Regards,
Einar