Forum: Ruby on Rails __END__ equivalent for erb?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
John W. (Guest)
on 2006-02-07 17:24
(Received via mailing list)
Time and time again I find the need to terminate evaluation of an erb
file on a certain line for debugging purposes, but can't figure out a
way to do it. Is this possible?

Thanks!
John
Alex Y. (Guest)
on 2006-02-07 17:27
(Received via mailing list)
John W. wrote:
> Time and time again I find the need to terminate evaluation of an erb
> file on a certain line for debugging purposes, but can't figure out a
> way to do it. Is this possible?
You might have some luck with the breakpoint method.
Mark Veerman (Guest)
on 2006-02-07 17:42
(Received via mailing list)
John W. <devlists-rubyonrails@...> writes:

>
> Time and time again I find the need to terminate evaluation of an erb
> file on a certain line for debugging purposes, but can't figure out a
> way to do it. Is this possible?
>
You need breakpointer.  You'll need to start the breakpointer utility in
another
terminal:
./script/breakpointer

Now you can put the function breakpoint() anywhere in your controllers
and I
think in erb as well.  The server will halt execution at the breakpoint,
and the
terminal that's running breakpointer will put you into a ruby console
where you
can inspect variables modify values, etc.  Type CTRL-D to resume.

Mark
Duane J. (Guest)
on 2006-02-11 22:11
(Received via mailing list)
On Feb 7, 2006, at 8:21 AM, John W. wrote:

> Time and time again I find the need to terminate evaluation of an erb
> file on a certain line for debugging purposes, but can't figure out a
> way to do it. Is this possible?
>
> Thanks!
> John
>
>
I highly recommend breakpoint as well; however, if you want to
"terminate" an erb file, you could wrap the second half in an "if
false" statement:

<% if false %>
html goes here
<% other erb statements %>
<% end %>

It's kind of a block comment hack for erb.

Duane J.
(canadaduane)
http://blog.inquirylabs.com/
John W. (Guest)
on 2006-02-15 23:53
(Received via mailing list)
On Saturday, February 11, 2006, at 1:08 PM, Duane J. wrote:
><% if false %>
>html goes here
><% other erb statements %>
><% end %>

More inline with what I was looking for, but still won't allow invalid
code in the block, which __END__ let's you do...a *very* useful feature.

Consider a page that does some dynamic actions in which you're getting a
nil exception, but you're not sure why. You'd like to lump a few
.inspect calls at the top of the file and then end processing there, but
it doesn't seem this is possible. I feel this would be an extremely
useful feature...

Thanks for the suggestions regardless!

John
This topic is locked and can not be replied to.