module Roda::RodaPlugins::CaptureERB::InstanceMethods
def capture_erb(&block)
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(&block) outvar = render_opts[:template_opts][:outvar] buf_was = instance_variable_get(outvar) if buf_was.respond_to?(:capture) && !buf_was.instance_of?(String) buf_was.capture(&block) else begin instance_variable_set(outvar, String.new) yield.to_s ensure instance_variable_set(outvar, buf_was) if outvar && buf_was end end end