Module: Pantheios::ApplicationLayer::StockSeverityLevels::Internal_

Defined in:
lib/pantheios/application_layer/stock_severity_levels.rb

Constant Summary collapse

STOCK_SEVERITY_LEVELS_ =
{

  :violation => [ 1, 'Violation', [ :emergency ] ],
  :alert => [ 2, 'Alert' ],
  :critical => [ 3, 'Critical' ],
  :failure => [ 4, 'Failure' ],
  :warning => [ 5, 'Warning', [ :warn ] ],
  :notice => [ 6, 'Notice' ],
  :informational => [ 7, 'Informational', [ :info ] ],
  :debug0 => [ 8, 'Debug-0' ],
  :debug1 => [ 9, 'Debug-1' ],
  :debug2 => [ 10, 'Debug-2' ],
  :debug3 => [ 11, 'Debug-3' ],
  :debug4 => [ 12, 'Debug-4' ],
  :trace => [ 13, 'Trace' ],
  :benchmark => [ 14, 'Benchmark' ],
}

Class Method Summary collapse

Class Method Details

.create_level_keys(m) ⇒ Object



78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/pantheios/application_layer/stock_severity_levels.rb', line 78

def self.create_level_keys m

  r = m.keys

  m.each do |k, ar|

    (ar[2] || []).each do |al|

      r << al
    end
  end

  r.uniq
end

.create_level_string_map(m) ⇒ Object



110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
# File 'lib/pantheios/application_layer/stock_severity_levels.rb', line 110

def self.create_level_string_map m

  r = {}

  m.each do |s, ar|

    warn 'invalid start-up' unless ::Symbol === s
    warn 'invalid start-up' unless ::Array === ar

    ([s] + (ar[2] || [])).each do |al|

      r[al] = ar[1]
    end
  end

  r
end

.create_level_value_map(m) ⇒ Object



93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
# File 'lib/pantheios/application_layer/stock_severity_levels.rb', line 93

def self.create_level_value_map m

  r = {}

  m.each do |s, ar|

    warn 'invalid start-up' unless ::Symbol === s
    warn 'invalid start-up' unless ::Array === ar

    ([s] + (ar[2] || [])).each do |al|

      r[al] = ar[0]
    end
  end

  r
end