Method: ActionView::Helpers::CaptureHelper#with_output_buffer
- Defined in:
- actionview/lib/action_view/helpers/capture_helper.rb
#with_output_buffer(buf = nil) ⇒ Object
Use an alternate output buffer for the duration of the block. Defaults to a new empty string.
221 222 223 224 225 226 227 228 229 230 231 232 233 |
# File 'actionview/lib/action_view/helpers/capture_helper.rb', line 221 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 |