Class: CVEList::MalformedCVE

Inherits:
Object
  • Object
show all
Defined in:
lib/cvelist/malformed_cve.rb

Overview

Represents malformed/invalid CVE JSON that could not be loaded.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path, exception) ⇒ MalformedCVE

Initializes the malformed json.

Parameters:

  • path (String)

    Path to the JSON file.

  • exception (StandardError)

    The exception encountered when parsing the JSON file.



26
27
28
29
# File 'lib/cvelist/malformed_cve.rb', line 26

def initialize(path,exception)
  @path      = path
  @exception = exception
end

Instance Attribute Details

#exceptionStandardError (readonly)

The exception encountered when parsing the JSON file.

Returns:

  • (StandardError)


15
16
17
# File 'lib/cvelist/malformed_cve.rb', line 15

def exception
  @exception
end

#pathString (readonly)

Path to the JSON file.

Returns:

  • (String)


10
11
12
# File 'lib/cvelist/malformed_cve.rb', line 10

def path
  @path
end

Instance Method Details

#to_sString

Converts the malformed JSON back into a String.

Returns:

  • (String)

    The String containing the #path, the #exception class and message.



37
38
39
# File 'lib/cvelist/malformed_cve.rb', line 37

def to_s
  "#{@path}: #{@exception.class}: #{@exception.message}"
end