Files
metasploit-gs/lib/rex/ui/text/output/buffer.rb
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

62 lines
741 B
Ruby
Raw Normal View History

# -*- coding: binary -*-
2005-07-14 22:58:09 +00:00
module Rex
module Ui
module Text
###
#
# This class implements output against a buffer.
#
###
class Output::Buffer < Rex::Ui::Text::Output
2005-11-15 05:22:13 +00:00
#
# Initializes an output buffer.
#
2005-07-14 22:58:09 +00:00
def initialize
self.buf = ''
end
2013-08-30 16:28:33 -05:00
def supports_color?
false
end
2013-08-30 16:28:33 -05:00
2005-11-15 05:22:13 +00:00
#
# Appends the supplied message to the output buffer.
#
def print_raw(msg = '')
2005-07-14 22:58:09 +00:00
self.buf += msg || ''
2013-08-30 16:28:33 -05:00
2005-10-02 03:21:26 +00:00
msg
2005-07-14 22:58:09 +00:00
end
2013-08-30 16:28:33 -05:00
#
# Read everything out of the buffer and reset it
#
def dump_buffer
self.buf ||= ''
buffer = self.buf.dup
reset()
buffer
end
2013-08-30 16:28:33 -05:00
2005-11-15 05:22:13 +00:00
#
# Reset the buffer to an empty string.
#
2005-07-14 22:58:09 +00:00
def reset
self.buf = ''
end
2013-08-30 16:28:33 -05:00
2005-11-15 05:22:13 +00:00
#
# The underlying buffer state.
#
2005-07-14 22:58:09 +00:00
attr_accessor :buf
end
end
end
end