module Roda::RodaPlugins::CaptureERB::InstanceMethods

def capture_erb

Restore the previous ERB output buffer before returning.
Return the value of the block, converted to a string.
with an empty string, and then yield to the block.
Temporarily replace the ERB output buffer
def capture_erb
  outvar = render_opts[:template_opts][:outvar]
  buf_was = instance_variable_get(outvar)
  instance_variable_set(outvar, String.new)
  yield.to_s
ensure
  instance_variable_set(outvar, buf_was) if outvar && buf_was
end