Project

General

Profile

Download (673 Bytes) Statistics
| Branch: | Tag: | Revision:
module HostStatus
class Global
OK = 0
WARN = 1
ERROR = 2

attr_accessor :status

def self.build(statuses, options = {})
max_status = statuses.select { |s| s.relevant? }.map { |s| s.to_global(options) }.max

new(max_status || OK)
end

def self.status_name
N_('Global')
end

def name
self.class.status_name
end

def initialize(status)
self.status = status
end

def to_label
case status
when OK
N_('OK')
when WARN
N_('Warning')
when ERROR
N_('Error')
else
raise 'Unknown global status'
end
end
end
end
(3-3/4)