Sha256: f8e94b5365c0806183250cb64c444056fab94c9296a387155db01d38f27c7afa

Contents?: true

Size: 752 Bytes

Versions: 5

Compression:

Stored size: 752 Bytes

Contents

require 'rex/ui'

module Rex
module Ui
module Text

###
#
# This class implements output against a buffer.
#
###
class Output::Buffer < Rex::Ui::Text::Output

	#
	# Initializes an output buffer.
	#
	def initialize
		self.buf = ''
	end

	def supports_color?
		false
	end

	#
	# Appends the supplied message to the output buffer.
	#
	def print_raw(msg = '')
		self.buf += msg || ''

		if self.on_print_proc
			self.on_print_proc.call(msg)
		end

		msg
	end


	#
	# Read everything out of the buffer and reset it
	#
	def dump_buffer
		self.buf ||= ''
		buffer = self.buf.dup
		reset()
		buffer
	end

	#
	# Reset the buffer to an empty string.
	#
	def reset
		self.buf = ''
	end

	#
	# The underlying buffer state.
	#
	attr_accessor :buf

end

end
end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
librex-0.0.6 lib/rex/ui/text/output/buffer.rb
librex-0.0.5 lib/rex/ui/text/output/buffer.rb
librex-0.0.4 lib/rex/ui/text/output/buffer.rb
librex-0.0.3 lib/rex/ui/text/output/buffer.rb
librex-0.0.1 lib/rex/ui/text/output/buffer.rb