David and Sharon Phillips
7/22/2007 5:27:00 AM
On 22/07/2007, at 2:13 PM, Frank Church wrote:
> Is there any code in this ERB snippet that causes text after the EOF
> to be included in the template.
>
> Unless my understanding of ERB is inadequate there has to be some
> bug in it.
> It has me at my wit's end.
>
> =============
>
> template = ERB.new <<-EOF
>
> # rsync push mode
>
> #rsync_push_command check
>
> # <%= rsync_push_command %>
>
> # rsync_forced_command
> # <%= rsync_forced_command %>
> #
>
> EOF
>
> some program code here
>
> =====
> After execution the text "some program code here" appears in the
> template's output
>
> Are there some circumstances under which ERB goes haywire?
>
> Is there an alternate syntax to the ERB.NEW <<-EOF ... EOF syntax for
> when the text is on multiple lines.
>
> - Frank
Hi Frank,
I'm not that familiar with erb, but from what you've described I'm
pretty sure the error's with the text block not ending where you want
it to.
Are you using an editor with syntax highlighting? If so, this will
show where the text block stops. The last EOF must have no whitespace
before it, and a carriage return immediately after. It's easy to get
caught out with a stray space on the end of the line.
Cheers,
Dave