Class: CvssSuite::InvalidCvss

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

Overview

This class represents a invalid CVSS vector.

Instance Attribute Summary

Attributes inherited from Cvss

#base

Instance Method Summary collapse

Methods inherited from Cvss

#severity, #vector

Constructor Details

#initialize(vector = nil) ⇒ InvalidCvss

rubocop:disable Lint/MissingSuper

Creates a new invalid CVSS vector, remembering the vector that was rejected so the error it raises can name it. Cannot call super: that parses the vector, which is the thing that already failed.

Deliberately not stored as @vector: #vector reads that through to_s, and .new accepts any object, so an object with a hostile to_s would turn a total reader into one that raises.



21
22
23
# File 'lib/cvss_suite/invalid_cvss.rb', line 21

def initialize(vector = nil)
  @rejected = vector
end

Instance Method Details

#base_scoreObject

Since this is an invalid CVSS vector, it always throws an exception.



40
41
42
# File 'lib/cvss_suite/invalid_cvss.rb', line 40

def base_score
  check_validity
end

#environmental_scoreObject

Since this is an invalid CVSS vector, it always throws an exception.



52
53
54
# File 'lib/cvss_suite/invalid_cvss.rb', line 52

def environmental_score
  check_validity
end

#overall_scoreObject

Since this is an invalid CVSS vector, it always throws an exception.



58
59
60
# File 'lib/cvss_suite/invalid_cvss.rb', line 58

def overall_score
  check_validity
end

#temporal_scoreObject

Since this is an invalid CVSS vector, it always throws an exception.



46
47
48
# File 'lib/cvss_suite/invalid_cvss.rb', line 46

def temporal_score
  check_validity
end

#valid?Boolean

Since this is an invalid CVSS vector, it always returns false.



28
29
30
# File 'lib/cvss_suite/invalid_cvss.rb', line 28

def valid?
  false
end

#versionObject

Since this is an invalid CVSS vector, it always throws an exception.



34
35
36
# File 'lib/cvss_suite/invalid_cvss.rb', line 34

def version
  check_validity
end