Module: Ronin::Core::OutputFormats::ClassMethods
- Defined in:
- lib/ronin/core/output_formats.rb
Overview
Class methods which are added to another OutputFormats
module
when Ronin::Core::OutputFormats is included.
Instance Method Summary collapse
-
#file_exts ⇒ Hash{String => Class<OutputFormat>}
Output formats grouped by file extension.
-
#formats ⇒ Hash{Symbol => Class<OutputFormat>}
Output formats grouped by name.
-
#infer_from(path) ⇒ Class<OutputFormat>, Class<TXT>
Infers the output format from the output file path.
-
#register(name, ext, output_format) ⇒ Object
Registers a new output format.
Instance Method Details
#file_exts ⇒ Hash{String => Class<OutputFormat>}
Output formats grouped by file extension.
61 62 63 |
# File 'lib/ronin/core/output_formats.rb', line 61 def file_exts @file_exts ||= {} end |
#formats ⇒ Hash{Symbol => Class<OutputFormat>}
Output formats grouped by name.
52 53 54 |
# File 'lib/ronin/core/output_formats.rb', line 52 def formats @formats ||= {} end |
#infer_from(path) ⇒ Class<OutputFormat>, Class<TXT>
Infers the output format from the output file path.
83 84 85 |
# File 'lib/ronin/core/output_formats.rb', line 83 def infer_from(path) file_exts.fetch(File.extname(path),TXT) end |
#register(name, ext, output_format) ⇒ Object
Registers a new output format.
68 69 70 71 |
# File 'lib/ronin/core/output_formats.rb', line 68 def register(name,ext,output_format) formats[name] = output_format file_exts[ext] = output_format end |