Class: NagiosAnalyzer::SectionDecorator

Inherits:
Object
  • Object
show all
Defined in:
lib/nagios_analyzer/section_decorator.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(section) ⇒ SectionDecorator

Returns a new instance of SectionDecorator.



18
19
20
# File 'lib/nagios_analyzer/section_decorator.rb', line 18

def initialize(section)
  @object = section
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



16
17
18
# File 'lib/nagios_analyzer/section_decorator.rb', line 16

def object
  @object
end

Instance Method Details

#current_stateObject



22
23
24
25
26
# File 'lib/nagios_analyzer/section_decorator.rb', line 22

def current_state
  if object.current_state
    Status::STATES[object.current_state]
  end
end

#flags_shortObject



28
29
30
31
32
33
# File 'lib/nagios_analyzer/section_decorator.rb', line 28

def flags_short
  ret = []
  ret.push (object.active_checks_enabled == 1)  ? "AC": "ac"
  ret.push (object.notifications_enabled == 1)  ? "NT": "nt"
  ret.join(",")
end