Class: Naginata::StatusDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/naginata/status_decorator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(status) ⇒ StatusDecorator

Returns a new instance of StatusDecorator.



8
9
10
# File 'lib/naginata/status_decorator.rb', line 8

def initialize(status)
  @object = status
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



6
7
8
# File 'lib/naginata/status_decorator.rb', line 6

def object
  @object
end

Instance Method Details

#hosts_tableObject



12
13
14
15
16
# File 'lib/naginata/status_decorator.rb', line 12

def hosts_table
  object.host_items.sort.map do |section|
    [object.nagios, section.host_name, section.decorate.current_state, section.decorate.flags_short, section.plugin_output]
  end
end

#services_tableObject



18
19
20
21
22
# File 'lib/naginata/status_decorator.rb', line 18

def services_table
  object.service_items.sort.map do |section|
    [object.nagios, section.host_name, section.service_description, section.decorate.current_state, section.decorate.flags_short, section.plugin_output]
  end
end