Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I escape the ERB tag in ERB

I have a simple fixture.yml file:

label:     body: "<%= variable %>" 

The issue is that the ERB code is parsed as part of loading the fixture, whereas I actually want the body to be literally "<%= variable %>" (un-interpolated).

How do I escape the ERB tag?

like image 978
Daniel Avatar asked Feb 23 '10 22:02

Daniel


1 Answers

Add a second % to the opening tag:

label:     body: "<%%= variable %>" 

The <%% sequence is valid ERB, rendered as a literal <%.

like image 168
molf Avatar answered Sep 19 '22 21:09

molf