Module: CertBot::Data::UpdateStatus

Defined in:
lib/cert_bot/data/update_status.rb

Overview

This module holds the update status defined by the BSI

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.string_mappingHash (private)

Returns the mapping from update status to its string representation.

Returns:

  • (Hash)

    the mapping from update status to its string representation



19
20
21
# File 'lib/cert_bot/data/update_status.rb', line 19

def string_mapping
  @string_mapping
end

Class Method Details

.get_mapping_for(update_status) ⇒ Symbol

module method to retrieve the severity symbol to the given severity string

Parameters:

  • update_status (String)

    the string with the update status

Returns:

  • (Symbol)

    returns the severity symbol or nil if the string could not be found



35
36
37
38
39
40
41
# File 'lib/cert_bot/data/update_status.rb', line 35

def self.get_mapping_for(update_status)
  initialize if (@string_mapping.eql?(nil))
  @string_mapping.each_pair { |key, value|
    return value if (key.eql?(update_status))
  }
  nil
end

.initializeObject

initialization of the static mapping values



12
13
14
# File 'lib/cert_bot/data/update_status.rb', line 12

def initialize
  initialize_mapping
end

.initialize_mappingObject (private)

initializes the mapping hash



22
23
24
25
26
27
28
# File 'lib/cert_bot/data/update_status.rb', line 22

def initialize_mapping
  @string_mapping = Hash.new
  @string_mapping["New"] = :new
  @string_mapping["Update"] = :update
  @string_mapping["Silent-Update"] = :silent_update
  nil
end