Class: Rex::Ui::Text::Output::Buffer

Inherits:
Rex::Ui::Text::Output show all
Defined in:
lib/rex/ui/text/output/buffer.rb

Overview

This class implements output against a buffer.

Constant Summary

Constants included from Color

Color::AnsiAttributes

Instance Attribute Summary collapse

Attributes inherited from Rex::Ui::Text::Output

#config

Instance Method Summary collapse

Methods inherited from Rex::Ui::Text::Output

#auto_color, #disable_color, #enable_color, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #update_prompt

Methods included from Color

#ansi, #colorize, #do_colorize, #reset_color, #substitute_colors

Methods inherited from Output

#flush, #print, #print_debug, #print_error, #print_good, #print_line, #print_status, #prompting, #prompting?

Constructor Details

#initializeBuffer

Initializes an output buffer.



17
18
19
# File 'lib/rex/ui/text/output/buffer.rb', line 17

def initialize
	self.buf = ''
end

Instance Attribute Details

#bufObject

The underlying buffer state.



55
56
57
# File 'lib/rex/ui/text/output/buffer.rb', line 55

def buf
  @buf
end

Instance Method Details

#dump_bufferObject

Read everything out of the buffer and reset it



38
39
40
41
42
43
# File 'lib/rex/ui/text/output/buffer.rb', line 38

def dump_buffer
	self.buf ||= ''
	buffer = self.buf.dup
	reset()
	buffer
end

Appends the supplied message to the output buffer.



28
29
30
31
32
# File 'lib/rex/ui/text/output/buffer.rb', line 28

def print_raw(msg = '')
	self.buf += msg || ''

	msg
end

#resetObject

Reset the buffer to an empty string.



48
49
50
# File 'lib/rex/ui/text/output/buffer.rb', line 48

def reset
	self.buf = ''
end

#supports_color?Boolean

Returns:

  • (Boolean)


21
22
23
# File 'lib/rex/ui/text/output/buffer.rb', line 21

def supports_color?
	false
end