class SystemdMon::Notification
Attributes
hostname[RW]
type[RW]
unit[RW]
Public Class Methods
new(hostname, unit)
click to toggle source
# File lib/systemd_mon/notification.rb, line 5 def initialize(hostname, unit) self.hostname = hostname self.unit = unit self.type = determine_type end
types()
click to toggle source
# File lib/systemd_mon/notification.rb, line 11 def self.types [:alert, :warning, :info, :ok] end
Public Instance Methods
type_text()
click to toggle source
# File lib/systemd_mon/notification.rb, line 15 def type_text type.to_s.capitalize end
Protected Instance Methods
determine_type()
click to toggle source
# File lib/systemd_mon/notification.rb, line 22 def determine_type if unit.state_change.ok? if unit.state_change.first.fail? :ok else :info end else :alert end end