title: How can I use views and layouts with Ruby and ERB (not Rails)?
body: <p>How can I use views and layouts with Ruby and ERB (not Rails)?</p>
  
  <p>Today i'm using this code to render my view: </p>
  
  <pre><code>def render(template_path, context = self)
   template = File.read(template_path)
   ERB.new(template).result(context.get_binding)
  end
  </code></pre>
  
  <p>This works very well, but how can I implement the same function, but to render the template inside a layout? I want to call render_with_layout(template_path, context = self), and so that it will have a default layout. </p>