Class: CvssSuite::Cvss31AndBefore
- Defined in:
- lib/cvss_suite/cvss_31_and_before.rb
Overview
This class represents any CVSS vector. Do not instantiate this class!
Instance Attribute Summary collapse
-
#environmental ⇒ Object
readonly
Metric of a CVSS vector for CVSS 2, 3, 3.1.
-
#temporal ⇒ Object
readonly
Metric of a CVSS vector for CVSS 2, 3, 3.1.
Attributes inherited from Cvss
Instance Method Summary collapse
-
#initialize(vector) ⇒ Cvss31AndBefore
constructor
Creates a new CVSS vector by a
vector
, for all CVSS versions through 3.1. -
#overall_score ⇒ Object
Returns the Overall Score of the CVSS vector.
-
#valid? ⇒ Boolean
Returns if CVSS vector is valid.
Methods inherited from Cvss
Constructor Details
#initialize(vector) ⇒ Cvss31AndBefore
Creates a new CVSS vector by a vector
, for all CVSS versions through 3.1.
Raises an exception if it is called on Cvss31AndBefore class.
20 21 22 23 24 |
# File 'lib/cvss_suite/cvss_31_and_before.rb', line 20 def initialize(vector) raise CvssSuite::Errors::InvalidParentClass, 'Do not instantiate this class!' if instance_of? Cvss31AndBefore super end |
Instance Attribute Details
#environmental ⇒ Object (readonly)
Metric of a CVSS vector for CVSS 2, 3, 3.1.
14 15 16 |
# File 'lib/cvss_suite/cvss_31_and_before.rb', line 14 def environmental @environmental end |
#temporal ⇒ Object (readonly)
Metric of a CVSS vector for CVSS 2, 3, 3.1.
14 15 16 |
# File 'lib/cvss_suite/cvss_31_and_before.rb', line 14 def temporal @temporal end |
Instance Method Details
#overall_score ⇒ Object
Returns the Overall Score of the CVSS vector.
41 42 43 44 45 46 47 |
# File 'lib/cvss_suite/cvss_31_and_before.rb', line 41 def overall_score check_validity return temporal_score if @temporal.valid? && !@environmental.valid? return environmental_score if @environmental.valid? base_score end |
#valid? ⇒ Boolean
Returns if CVSS vector is valid.
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/cvss_suite/cvss_31_and_before.rb', line 28 def valid? if @amount_of_properties >= required_amount_of_properties entered_keys = @properties.collect { |p| p[:name] } return false if (entered_keys - allowed_abbreviations).size.positive? check_metrics_validity else false end end |