Class: CVESchema::CVE::ProblemType

Inherits:
Object
  • Object
show all
Defined in:
lib/cve_schema/cve/problem_type.rb

Overview

Represents an element within the "problemtype_data" JSON Array.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(description) ⇒ ProblemType

Initializes the problem-type object.



20
21
22
# File 'lib/cve_schema/cve/problem_type.rb', line 20

def initialize(description)
  @description = description
end

Instance Attribute Details

#descriptionArray<Description> (readonly) Also known as: descriptions



11
12
13
# File 'lib/cve_schema/cve/problem_type.rb', line 11

def description
  @description
end

Class Method Details

.from_json(json) ⇒ Array<Description>

Maps the parsed JSON to an Array of Description objects for #initialize.



35
36
37
# File 'lib/cve_schema/cve/problem_type.rb', line 35

def self.from_json(json)
 json['description'].map(&Description.method(:load))
end

.load(json) ⇒ ProblemType

Loads the problem-type object from parsed JSON.



50
51
52
# File 'lib/cve_schema/cve/problem_type.rb', line 50

def self.load(json)
  new(from_json(json))
end