Class: SystemdMon::Notification

Inherits:
Object
  • Object
show all
Defined in:
lib/systemd_mon/notification.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hostname, unit) ⇒ Notification

Returns a new instance of Notification.



5
6
7
8
9
# File 'lib/systemd_mon/notification.rb', line 5

def initialize(hostname, unit)
  self.hostname = hostname
  self.unit     = unit
  self.type     = determine_type
end

Instance Attribute Details

#hostnameObject

Returns the value of attribute hostname.



3
4
5
# File 'lib/systemd_mon/notification.rb', line 3

def hostname
  @hostname
end

#typeObject

Returns the value of attribute type.



3
4
5
# File 'lib/systemd_mon/notification.rb', line 3

def type
  @type
end

#unitObject

Returns the value of attribute unit.



3
4
5
# File 'lib/systemd_mon/notification.rb', line 3

def unit
  @unit
end

Class Method Details

.typesObject



11
12
13
# File 'lib/systemd_mon/notification.rb', line 11

def self.types
  [:alert, :warning, :info, :ok]
end

Instance Method Details

#type_textObject



15
16
17
# File 'lib/systemd_mon/notification.rb', line 15

def type_text
  type.to_s.capitalize
end