Class: Ronin::Core::OutputFormats::OutputDir
- Inherits:
-
OutputFormat
- Object
- OutputFormat
- Ronin::Core::OutputFormats::OutputDir
- Defined in:
- lib/ronin/core/output_formats/output_dir.rb
Overview
Base class that represents an output directory.
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The path to the output directory.
Class Method Summary collapse
-
.open(path) {|output_dir| ... } ⇒ Dir
Opens an output directory.
Instance Method Summary collapse
-
#close ⇒ Object
"Closes" the output directory.
-
#initialize(path) ⇒ OutputDir
constructor
Initializes the output directory.
Methods inherited from OutputFormat
Constructor Details
#initialize(path) ⇒ OutputDir
Initializes the output directory.
46 47 48 49 50 51 |
# File 'lib/ronin/core/output_formats/output_dir.rb', line 46 def initialize(path) super() @path = File.(path) FileUtils.mkdir_p(@path) end |
Instance Attribute Details
#path ⇒ String (readonly)
The path to the output directory.
38 39 40 |
# File 'lib/ronin/core/output_formats/output_dir.rb', line 38 def path @path end |
Class Method Details
.open(path) {|output_dir| ... } ⇒ Dir
Opens an output directory.
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/ronin/core/output_formats/output_dir.rb', line 71 def self.open(path) output_dir = new(path) if block_given? yield output_dir output_dir.close else return output_dir end end |
Instance Method Details
#close ⇒ Object
Note:
This method is mainly for compatibility with Ronin::Core::OutputFormats::OutputFile.
"Closes" the output directory.
87 88 |
# File 'lib/ronin/core/output_formats/output_dir.rb', line 87 def close end |