Sha256: b2db7c644f6b6eca779d97ba8dbc8d2ed647db5a1bacfade5d12f5ca420d9e34

Contents?: true

Size: 644 Bytes

Versions: 1

Compression:

Stored size: 644 Bytes

Contents

require 'glue/attribute'

require 'nitro/shaders'

module Nitro

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

module OutputBuffering
	# Output buffers stack, used for php-style nested output 
	# buffering.

	attr :out_buffers
	
	# Start (push) a new output buffer.

	def ob_start
		@out_buffers ||= []
		@out_buffers.push(@out)
		@out = ''
	end
	
	# End (pop) the current output buffer.
	
	def ob_end
		@out = @out_buffers.pop
	end
	
	# End (pop) the current output buffer and write to the parent.
	
	def ob_write_end
		nested_buffer = @out
		@out = @out_buffers.pop
		@out << nested_buffer
	end
end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
nitro-0.17.0 lib/nitro/buffering.rb