Class: Rex::Ui::Text::Output::File
- Inherits:
-
Rex::Ui::Text::Output
- Object
- Output
- Rex::Ui::Text::Output
- Rex::Ui::Text::Output::File
- Defined in:
- lib/rex/ui/text/output/file.rb
Overview
This class implements output against a file
Instance Attribute Summary collapse
-
#fd ⇒ Object
Returns the value of attribute fd.
Attributes inherited from Rex::Ui::Text::Output
Instance Method Summary collapse
- #close ⇒ Object
-
#initialize(path, mode = 'wb') ⇒ File
constructor
A new instance of File.
-
#print_raw(msg = '') ⇒ Object
(also: #write)
Prints the supplied message to file output.
- #supports_color? ⇒ Boolean
Methods inherited from Rex::Ui::Text::Output
#auto_color, #disable_color, #enable_color, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #puts, #reset, #update_prompt
Methods inherited from Output
#flush, #print, #print_error, #print_good, #print_line, #print_status, #print_warning, #prompting, #prompting?
Constructor Details
#initialize(path, mode = 'wb') ⇒ File
Returns a new instance of File.
16 17 18 |
# File 'lib/rex/ui/text/output/file.rb', line 16 def initialize(path, mode='wb') self.fd = ::File.open(path, mode) end |
Instance Attribute Details
#fd ⇒ Object
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
#close ⇒ Object
35 36 37 38 |
# File 'lib/rex/ui/text/output/file.rb', line 35 def close self.fd.close if self.fd self.fd = nil end |
#print_raw(msg = '') ⇒ Object Also known as: write
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
20 21 22 |
# File 'lib/rex/ui/text/output/file.rb', line 20 def supports_color? false end |