Class: Rex::Ui::Text::Output::File

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

Overview

This class implements output against a file

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, #reset, #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

#initialize(path) ⇒ File

Returns a new instance of File.



16
17
18
# File 'lib/rex/ui/text/output/file.rb', line 16

def initialize(path)
	self.fd = ::File.open(path, "wb")
end

Instance Attribute Details

#fdObject

Returns the value of attribute fd.



14
15
16
# File 'lib/rex/ui/text/output/file.rb', line 14

def fd
  @fd
end

Instance Method Details

#closeObject



34
35
36
37
# File 'lib/rex/ui/text/output/file.rb', line 34

def close
	self.fd.close if self.fd
	self.fd = nil
end

Prints the supplied message to file output.



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

def print_raw(msg = '')
	return if not self.fd
	self.fd.write(msg)
	self.fd.flush
	msg
end

#supports_color?Boolean

Returns:

  • (Boolean)


20
21
22
# File 'lib/rex/ui/text/output/file.rb', line 20

def supports_color?
	false
end