Files
metasploit-gs/lib/rex/ui/text/output/buffer.rb
T
James Lee c4fe7193f1 print_raw receives color-substituted strings, don't override print
git-svn-id: file:///home/svn/framework3/trunk@8669 4d416f70-5f16-0410-b530-b9f4589650da
2010-02-26 20:10:18 +00:00

66 lines
752 B
Ruby

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