Class: ZombieCheck::Ping::HostStat
- Inherits:
-
Object
- Object
- ZombieCheck::Ping::HostStat
- Defined in:
- lib/zombie_check/ping/host_stat.rb
Instance Attribute Summary collapse
-
#durations ⇒ Object
Returns the value of attribute durations.
-
#host ⇒ Object
Returns the value of attribute host.
-
#lost ⇒ Object
Returns the value of attribute lost.
Instance Method Summary collapse
-
#initialize(ping) ⇒ HostStat
constructor
A new instance of HostStat.
- #stored ⇒ Object
- #stored? ⇒ Boolean
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
#durations ⇒ Object
Returns the value of attribute durations.
5 6 7 |
# File 'lib/zombie_check/ping/host_stat.rb', line 5 def durations @durations end |
#host ⇒ Object
Returns the value of attribute host.
5 6 7 |
# File 'lib/zombie_check/ping/host_stat.rb', line 5 def host @host end |
#lost ⇒ Object
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
#stored ⇒ Object
22 23 24 |
# File 'lib/zombie_check/ping/host_stat.rb', line 22 def stored CheckerReport.nodes[host] end |
#stored? ⇒ Boolean
18 19 20 |
# File 'lib/zombie_check/ping/host_stat.rb', line 18 def stored? stored ? true : false end |