Module: N::OutputBuffering

Defined in:
lib/nitro/buffering.rb

Overview

The output buffering mixin. Provides php-style output buffering functionality.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#out_buffersObject (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_endObject

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_startObject

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_endObject

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