module ActionView::Helpers::CaptureHelper

def with_output_buffer(buf = nil) # :nodoc:

:nodoc:
Defaults to a new empty string.
Use an alternate output buffer for the duration of the block.
def with_output_buffer(buf = nil) # :nodoc:
  unless buf
    buf = ActionView::OutputBuffer.new
    if output_buffer && output_buffer.respond_to?(:encoding)
      buf.force_encoding(output_buffer.encoding)
    end
  end
  self.output_buffer, old_buffer = buf, output_buffer
  yield
  output_buffer
ensure
  self.output_buffer = old_buffer
end