title: Helper function in Sinatra
body: <p>I'm using Sinatra to monitor a server. I need to read the list of folders in a master folder, and the content of meta.xml inside each folder. This is the desired output:</p>
  
  <pre><code>&lt;folders&gt;
      &lt;folder 1&gt;
          &lt;meta.xml content&gt;
      &lt;folder 2&gt;
          &lt;meta.xml content&gt;
  &lt;\folders&gt;
  </code></pre>
  
  <p>This is my current code:</p>
  
  <pre><code>require 'sinatra'
  require 'json'
  require 'haml'
  
  get '/processed' do
      status 200
      meeting_dir="/home/default"
      Dir.entries(meeting_dir)
  end
  </code></pre>
  
  <p>I'm confused about Sinatra printing the values of all the variable inside the get block. If I want to write a subfunction getxml to generate the xml, where should I put it?</p>