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

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

Overview

This class implements output against a buffer.

Defined Under Namespace

Modules: Stdout

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, #print_warning, #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, #print_warning, #prompting, #prompting?

Constructor Details

#initializeBuffer

Initializes an output buffer.


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

def initialize
  self.buf = ''
end

Instance Attribute Details

#bufObject

The underlying buffer state.


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

def buf
  @buf
end

Instance Method Details

#dump_bufferObject

Read everything out of the buffer and reset it


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

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

Appends the supplied message to the output buffer.


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

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

  msg
end

#resetObject

Reset the buffer to an empty string.


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

def reset
  self.buf = ''
end

#supports_color?Boolean

Returns:

  • (Boolean)

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

def supports_color?
  false
end