Class: CvssSuite::Cvss40AndLater

Inherits:
Cvss
  • Object
show all
Defined in:
lib/cvss_suite/cvss_40_and_later.rb

Overview

This class represents any CVSS vector. Do not instantiate this class!

Direct Known Subclasses

Cvss40

Instance Attribute Summary collapse

Attributes inherited from Cvss

#base

Instance Method Summary collapse

Methods inherited from Cvss

#severity, #vector

Constructor Details

#initialize(vector) ⇒ Cvss40AndLater

Creates a new CVSS vector by a vector, for all CVSS versions from 4.0.

Raises an exception if it is called on Cvss40AndLater class.



20
21
22
23
24
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 20

def initialize(vector)
  raise CvssSuite::Errors::InvalidParentClass, 'Do not instantiate this class!' if instance_of? Cvss40AndLater

  super
end

Instance Attribute Details

#environmentalObject (readonly)

Metric of a CVSS vector for CVSS 4.0.



14
15
16
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 14

def environmental
  @environmental
end

#environmental_securityObject (readonly)

Metric of a CVSS vector for CVSS 4.0.



14
15
16
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 14

def environmental_security
  @environmental_security
end

#supplementalObject (readonly)

Metric of a CVSS vector for CVSS 4.0.



14
15
16
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 14

def supplemental
  @supplemental
end

#threatObject (readonly)

Metric of a CVSS vector for CVSS 4.0.



14
15
16
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 14

def threat
  @threat
end

Instance Method Details

#overall_scoreObject

Returns the Overall Score of the CVSS vector.



39
40
41
42
43
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 39

def overall_score
  check_validity

  @all_up.score
end

#scoreObject

Alias for overall_score.



47
48
49
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 47

def score
  overall_score
end

#valid?Boolean

Returns if CVSS vector is valid.

Returns:

  • (Boolean)


28
29
30
31
32
33
34
35
# File 'lib/cvss_suite/cvss_40_and_later.rb', line 28

def valid?
  if @amount_of_properties >= required_amount_of_properties
    @base.valid?

  else
    false
  end
end