Class: CVESchema::CVE::Affects
- Inherits:
-
Object
- Object
- CVESchema::CVE::Affects
- Defined in:
- lib/cve_schema/cve/affects.rb
Overview
Represents the "affects"
JSON object.
Instance Attribute Summary collapse
- #vendor ⇒ Array<Vendor> (also: #vendors) readonly
Class Method Summary collapse
-
.from_json(json) ⇒ Array<Vendor>
Maps the parsed JSON to an Array of Vendor objects for #initialize.
-
.load(json) ⇒ Affects
Loads the affects object from parsed JSON.
Instance Method Summary collapse
-
#initialize(vendor) ⇒ Affects
constructor
Initializes the affects container.
Constructor Details
#initialize(vendor) ⇒ Affects
Initializes the affects container.
20 21 22 |
# File 'lib/cve_schema/cve/affects.rb', line 20 def initialize(vendor) @vendor = vendor end |
Instance Attribute Details
#vendor ⇒ Array<Vendor> (readonly) Also known as: vendors
11 12 13 |
# File 'lib/cve_schema/cve/affects.rb', line 11 def vendor @vendor end |
Class Method Details
.from_json(json) ⇒ Array<Vendor>
Maps the parsed JSON to an Array of Vendor objects for #initialize.
34 35 36 |
# File 'lib/cve_schema/cve/affects.rb', line 34 def self.from_json(json) json['vendor']['vendor_data'].map(&Vendor.method(:load)) end |
.load(json) ⇒ Affects
Loads the affects object from parsed JSON.
49 50 51 |
# File 'lib/cve_schema/cve/affects.rb', line 49 def self.load(json) new(from_json(json)) end |