Module: Wordlist::Format
- Defined in:
- lib/wordlist/format.rb
Overview
Handles wordlist format detection.
Constant Summary collapse
- FILE_FORMATS =
Mapping of file extensions to formats
{ '.txt' => :txt, '.gz' => :gzip, '.bz2' => :bzip2, '.xz' => :xz, '.zip' => :zip, '.7z' => :"7zip" }
- FORMATS =
Valid formats.
FILE_FORMATS.values
Class Method Summary collapse
-
.infer(path) ⇒ :txt, ...
Infers the format from the given file name.
Class Method Details
.infer(path) ⇒ :txt, ...
Infers the format from the given file name.
35 36 37 38 39 |
# File 'lib/wordlist/format.rb', line 35 def self.infer(path) FILE_FORMATS.fetch(::File.extname(path)) do raise(UnknownFormat,"could not infer the format of file: #{path.inspect}") end end |