Help needed with this ERB code

Discussion in 'Ruby' started by Frank Church, Jul 21, 2007.

  1. Frank Church

    Frank Church Guest

    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
    Frank Church, Jul 21, 2007
    #1
    1. Advertising

  2. Frank Church

    Frank Church Guest

    On 21/07/07, 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
    >



    Is there some way the ERB internal stack or whatever can be reset
    between calls to ensure that there is nothing left in there to cause
    errors.
    Frank Church, Jul 21, 2007
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. PAolo

    Embedding python a la erb

    PAolo, Jun 4, 2008, in forum: Python
    Replies:
    0
    Views:
    272
    PAolo
    Jun 4, 2008
  2. Steve V
    Replies:
    6
    Views:
    237
    Steve V
    Apr 20, 2005
  3. Pokkai Dokkai

    erb question --urgent help needed?

    Pokkai Dokkai, Jun 6, 2008, in forum: Ruby
    Replies:
    5
    Views:
    122
    Jano Svitok
    Jun 6, 2008
  4. Eric Michael

    Help with Custom ERB Templates

    Eric Michael, Aug 28, 2008, in forum: Ruby
    Replies:
    1
    Views:
    102
    Eric Michael
    Aug 28, 2008
  5. Dan Thomas

    link to .erb file, from .erb file

    Dan Thomas, Jan 26, 2011, in forum: Ruby
    Replies:
    4
    Views:
    165
    Dan Thomas
    Jan 26, 2011
Loading...

Share This Page