title: How to render an Array to a YAML list with ERB?
body: <p>I am trying to render an Array with ERB to a YAML file.</p>
  
  <p>Input:</p>
  
  <pre><code>arr = [1,2,3]
  </code></pre>
  
  <p>Expected output:</p>
  
  <pre><code>  ---
    tags:
      - 1
      - 2
      - 3
  </code></pre>
  
  <p>Code:</p>
  
  <pre><code>tags:
    &lt;%- @arr.each do |tag| -%&gt;
    - &lt;%= tag %&gt;
    &lt;% end -%&gt;
    - extra-tag
  </code></pre>
  
  <p>This renders the following YAML</p>
  
  <pre><code>---
  tags:
    - 1 - 2 -3
  </code></pre>
  
  <p>Is there a way to render this properly?</p>