Class: ZombieCheck::Ping::HostStat

Inherits:
Object
  • Object
show all
Defined in:
lib/zombie_check/ping/host_stat.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(ping) ⇒ HostStat

Returns a new instance of HostStat.



7
8
9
10
11
12
13
14
15
16
# File 'lib/zombie_check/ping/host_stat.rb', line 7

def initialize(ping)
  @durations ||= []
  @lost ||= 0
  @host = ping.host
  if (ping_duration = ping.duration)
    @durations << (ping_duration * 1000).round(PRECISION)
  else
    @lost += 1
  end
end

Instance Attribute Details

#durationsObject

Returns the value of attribute durations.



5
6
7
# File 'lib/zombie_check/ping/host_stat.rb', line 5

def durations
  @durations
end

#hostObject

Returns the value of attribute host.



5
6
7
# File 'lib/zombie_check/ping/host_stat.rb', line 5

def host
  @host
end

#lostObject

Returns the value of attribute lost.



5
6
7
# File 'lib/zombie_check/ping/host_stat.rb', line 5

def lost
  @lost
end

Instance Method Details

#storedObject



22
23
24
# File 'lib/zombie_check/ping/host_stat.rb', line 22

def stored
  CheckerReport.nodes[host]
end

#stored?Boolean

Returns:

  • (Boolean)


18
19
20
# File 'lib/zombie_check/ping/host_stat.rb', line 18

def stored?
  stored ? true : false
end