Module: CertBot::Data::Severity
- Defined in:
- lib/cert_bot/data/severity.rb
Overview
This module holds the severity rating defined by the BSI
Class Attribute Summary collapse
-
.string_mapping ⇒ Hash
private
The mapping from severity to its string representation.
-
.values ⇒ Hash
readonly
The mapping severity to all rating higher of equal to the value.
Class Method Summary collapse
-
.get_mapping_for(severity_string) ⇒ Symbol
module method to retrieve the severity symbol to the given severity string.
-
.initialize ⇒ Object
initialization of the static mapping values.
-
.initialize_mapping ⇒ Object
private
initializes the mapping hash.
-
.initialize_values ⇒ Object
private
initializes the value hash.
Class Attribute Details
.string_mapping ⇒ Hash (private)
Returns the mapping from severity to its string representation.
23 24 25 |
# File 'lib/cert_bot/data/severity.rb', line 23 def string_mapping @string_mapping end |
.values ⇒ Hash (readonly)
Returns the mapping severity to all rating higher of equal to the value.
12 13 14 |
# File 'lib/cert_bot/data/severity.rb', line 12 def values @values end |
Class Method Details
.get_mapping_for(severity_string) ⇒ Symbol
module method to retrieve the severity symbol to the given severity string
49 50 51 52 53 54 55 |
# File 'lib/cert_bot/data/severity.rb', line 49 def self.get_mapping_for(severity_string) initialize if (@string_mapping.eql?(nil)) @string_mapping.each_pair { |key, value| return key if (value.include?(severity_string)) } nil end |
.initialize ⇒ Object
initialization of the static mapping values
15 16 17 18 |
# File 'lib/cert_bot/data/severity.rb', line 15 def initialize initialize_values initialize_mapping end |
.initialize_mapping ⇒ Object (private)
initializes the mapping hash
36 37 38 39 40 41 42 43 |
# File 'lib/cert_bot/data/severity.rb', line 36 def initialize_mapping @string_mapping = Hash.new @string_mapping[:low] = ["low", "niedrig"] @string_mapping[:medium] = ["medium", "mittel"] @string_mapping[:high] = ["high", "hoch"] @string_mapping[:critical] = ["critical", "kritisch"] nil end |
.initialize_values ⇒ Object (private)
initializes the value hash
26 27 28 29 30 31 32 33 |
# File 'lib/cert_bot/data/severity.rb', line 26 def initialize_values @values = Hash.new @values[:low] = [:low, :medium, :high, :critical] @values[:medium] = [:medium, :high, :critical] @values[:high] = [:high, :critical] @values[:critical] = [:critical] nil end |