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
    buf.force_encoding(output_buffer.encoding) if output_buffer
  end
  self.output_buffer, old_buffer = buf, output_buffer
  yield
  output_buffer
ensure
  self.output_buffer = old_buffer
end