Sha256: f0f2208a624a328ba34bf155ee6f020a251274baee7657e2a06d025e9da31322

Contents?: true

Size: 730 Bytes

Versions: 8

Compression:

Stored size: 730 Bytes

Contents

# * George Moschovitis  <gm@navel.gr>
# (c) 2004-2005 Navel, all rights reserved.
# $Id$

require 'glue/attribute'

require 'nitro/shaders'

module N

# 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

8 entries across 8 versions & 1 rubygems

Version Path
nitro-0.12.0 lib/nitro/buffering.rb
nitro-0.10.0 lib/nitro/buffering.rb
nitro-0.11.0 lib/nitro/buffering.rb
nitro-0.13.0 lib/nitro/buffering.rb
nitro-0.14.0 lib/nitro/buffering.rb
nitro-0.15.0 lib/nitro/buffering.rb
nitro-0.9.5 lib/nitro/buffering.rb
nitro-0.9.3 lib/nitro/buffering.rb