Class: Ronin::Core::OutputFormats::OutputFile
- Inherits:
-
OutputFormat
- Object
- OutputFormat
- Ronin::Core::OutputFormats::OutputFile
- Defined in:
- lib/ronin/core/output_formats/output_file.rb
Overview
Base class for all output file formats.
Instance Attribute Summary collapse
-
#io ⇒ IO
readonly
The output stream to write to.
Class Method Summary collapse
-
.open(path) {|output_format| ... } ⇒ OutputFormat
Opens an output file.
Instance Method Summary collapse
-
#close ⇒ Object
Closes the output file.
-
#initialize(io) ⇒ OutputFile
constructor
Initializes the output format.
Methods inherited from OutputFormat
Constructor Details
#initialize(io) ⇒ OutputFile
Initializes the output format.
44 45 46 47 48 |
# File 'lib/ronin/core/output_formats/output_file.rb', line 44 def initialize(io) super() @io = io end |
Instance Attribute Details
#io ⇒ IO (readonly)
The output stream to write to.
36 37 38 |
# File 'lib/ronin/core/output_formats/output_file.rb', line 36 def io @io end |
Class Method Details
.open(path) {|output_format| ... } ⇒ OutputFormat
Opens an output file.
68 69 70 71 72 73 74 75 76 77 |
# File 'lib/ronin/core/output_formats/output_file.rb', line 68 def self.open(path) output = new(File.open(path,'w')) if block_given? yield output output.close else return output end end |
Instance Method Details
#close ⇒ Object
Closes the output file.
82 83 84 |
# File 'lib/ronin/core/output_formats/output_file.rb', line 82 def close @io.close unless @io == $stdout end |