Public Instance methods
capture_erb()
Temporarily replace the ERB output buffer with an empty string, and then yield to the block. Return the value of the block, converted to a string. Restore the previous ERB output buffer before returning.
[show source]
# File lib/roda/plugins/capture_erb.rb 28 def capture_erb 29 outvar = render_opts[:template_opts][:outvar] 30 buf_was = instance_variable_get(outvar) 31 instance_variable_set(outvar, String.new) 32 yield.to_s 33 ensure 34 instance_variable_set(outvar, buf_was) if outvar && buf_was 35 end