Class: CVEList::CVE
- Inherits:
-
CVESchema::CVE
- Object
- CVESchema::CVE
- CVEList::CVE
- Defined in:
- lib/cvelist/cve.rb
Overview
Instance Attribute Summary collapse
-
#path ⇒ String
readonly
The path to the CVE JSON.
Class Method Summary collapse
-
.load(file) ⇒ CVE
Loads the CVE JSON from the given file.
-
.parse(json) ⇒ Hash{String => Object}
Parses the given JSON.
-
.read(file) ⇒ Hash{String => Object}
Parses the JSON in the given file.
Instance Method Summary collapse
-
#initialize(path, **kwargs) ⇒ CVE
constructor
Initializes the CVE.
Constructor Details
#initialize(path, **kwargs) ⇒ CVE
Initializes the CVE.
22 23 24 25 26 |
# File 'lib/cvelist/cve.rb', line 22 def initialize(path, **kwargs) super(**kwargs) @path = path end |
Instance Attribute Details
#path ⇒ String (readonly)
The path to the CVE JSON.
14 15 16 |
# File 'lib/cvelist/cve.rb', line 14 def path @path end |
Class Method Details
.load(file) ⇒ CVE
Loads the CVE JSON from the given file.
78 79 80 |
# File 'lib/cvelist/cve.rb', line 78 def self.load(file) new(file, **from_json(read(file))) end |
.parse(json) ⇒ Hash{String => Object}
Parses the given JSON.
42 43 44 45 46 |
# File 'lib/cvelist/cve.rb', line 42 def self.parse(json) MultiJson.load(json) rescue MultiJson::ParseError => error raise(InvalidJSON,error.) end |
.read(file) ⇒ Hash{String => Object}
Parses the JSON in the given file.
62 63 64 |
# File 'lib/cvelist/cve.rb', line 62 def self.read(file) parse(File.read(file)) end |