"-%>" appears in some code in a tutorial I'm doing, as a delimiter of some embedded ruby, like this:
<% 5.times do |i| -%>
<%= thumbnail_tag slideshow.slides[i] %>
<% end -%>
What does it mean? There's nothing in the book about it (Rails Up and Running)
From stackoverflow
-
In ERB it removes any newline that follows from the output.
-
This isn't a ruby delimiter, but rather a delimiter for the template language. Which templating language are you using?
-
The template language ERB supports
<%-' and-%>' in addition to the Ruby code delimiters<%' and%>'. Adding a minus to the inner side of the delimiter strips whitespace from the HTML next to the outer side of the delimiter.
0 comments:
Post a Comment