# ERB

ERB (Embedded RuBy) is a feature of Ruby that enables you to generate any kind of text from templates. This is the default templating engine for Rails and is the one we favour.&#x20;

{% hint style="info" %}
ERB is part of the Ruby standard library. You do not need to install any other software to use it.&#x20;
{% endhint %}

ERB copies the text portions of the template directly to the generated document, and only processes code that is identified by markers. Most ERB templates only use a combination of two tag markers, each of which cause the enclosed code to be handled in a particular way.

*A tag with an equals* sign indicates that enclosed code is an *expression*, and that **the renderer should substitute the code element with the result of the code** (as a string) when it renders the template. Use an expression to embed a line of code into the template, or to display the contents of a variable:

```
Hello, <%= @name %>.
Today is <%= Time.now.strftime('%A') %>.
```

*Tags without the equals sign* denote that the enclosed code is a *scriptlet*. Each scriptlet is caught and executed, and **the final result of the code is then injected in to the output at the point of the scriptlet**.

Scriptlets are most commonly used for embedding loops or conditional logic into templates:

```markup
<% for  @item in @shopping_list %>
  <%= @item %>
<% end  %>
```

Source: [An Introduction to ERB Templating](https://www.stuartellis.name/articles/erb/).

{% hint style="danger" %}
Even though some HAML templates are still used in some Prospect.io codebases, **you should not create new .haml files**. **We do favor ERB**.
{% endhint %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://prospect-io.gitbook.io/developer-playbook/our-stack/html/erb.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
