Method: Masscan::OutputFile#initialize

Defined in:
lib/masscan/output_file.rb

#initialize(path, format: self.class.infer_format(path)) ⇒ OutputFile

Initializes the output file.

Parameters:

  • path (String)

    The path to the output file.

  • format (:binary, :list, :json, :ndjson) (defaults to: self.class.infer_format(path))

    The format of the output file. Defaults to infer_format.

Raises:

  • (ArgumentError)

    The output format was not given and it cannot be inferred.



62
63
64
65
66
67
68
69
# File 'lib/masscan/output_file.rb', line 62

def initialize(path, format: self.class.infer_format(path))
  @path   = path
  @format = format

  @parser = PARSERS.fetch(format) do
    raise(ArgumentError,"unknown format: #{format.inspect}")
  end
end