Module: N::OutputBuffering
- Defined in:
- lib/nitro/buffering.rb
Overview
The output buffering mixin. Provides php-style output buffering functionality.
Instance Attribute Summary collapse
-
#out_buffers ⇒ Object
readonly
Output buffers stack, used for php-style nested output buffering.
Instance Method Summary collapse
-
#ob_end ⇒ Object
End (pop) the current output buffer.
-
#ob_start ⇒ Object
Start (push) a new output buffer.
-
#ob_write_end ⇒ Object
End (pop) the current output buffer and write to the parent.
Instance Attribute Details
#out_buffers ⇒ Object (readonly)
Output buffers stack, used for php-style nested output buffering.
18 19 20 |
# File 'lib/nitro/buffering.rb', line 18 def out_buffers @out_buffers end |
Instance Method Details
#ob_end ⇒ Object
End (pop) the current output buffer.
30 31 32 |
# File 'lib/nitro/buffering.rb', line 30 def ob_end @out = @out_buffers.pop end |
#ob_start ⇒ Object
Start (push) a new output buffer.
22 23 24 25 26 |
# File 'lib/nitro/buffering.rb', line 22 def ob_start @out_buffers ||= [] @out_buffers.push(@out) @out = '' end |
#ob_write_end ⇒ Object
End (pop) the current output buffer and write to the parent.
36 37 38 39 40 |
# File 'lib/nitro/buffering.rb', line 36 def ob_write_end nested_buffer = @out @out = @out_buffers.pop @out << nested_buffer end |