title: puppet - best way to collect data from custom types to be used in templates
body: <p>I have following manifest:</p>
  
  <pre><code>define foo($var) {
      file { $var: }
      $barclass::store += $var
  }
  
  class barclass {
      $store = []
      foo {
          "test1": var =&gt; "test1",
          "test2": var =&gt; "test2",
      }
  
      file { "myfile": content =&gt; template("puppet:///files/myfile.erb"); }
  }
  </code></pre>
  
  <p>And following erb template:</p>
  
  <pre><code>&lt;% store.each { |i| -%&gt; 
  &lt;%= i + " " -%&gt; 
  &lt;% } -%&gt; 
  </code></pre>
  
  <p>My intention here is to collect all <em>$var</em> variables used as parameter of type <em>foo</em>. And provide them in <em>myfile.erb</em> template. In my example <em>$store</em> variable was used.</p>
  
  <p>This example does not work. What have I wrong?</p>
  
  <p>Is there better way to achieve same thing? I basically need to collect parameters used in some type and then provide them in some template.</p>