Class: ZombieCheck::Ping::UnixPing
- Inherits:
-
PingSender
- Object
- PingSender
- ZombieCheck::Ping::UnixPing
- Defined in:
- lib/zombie_check/ping/ping_sender/unix_ping.rb
Instance Attribute Summary
Attributes inherited from PingSender
Instance Method Summary collapse
-
#initialize(host) ⇒ UnixPing
constructor
A new instance of UnixPing.
- #send ⇒ Object
Constructor Details
#initialize(host) ⇒ UnixPing
Returns a new instance of UnixPing.
5 6 7 |
# File 'lib/zombie_check/ping/ping_sender/unix_ping.rb', line 5 def initialize(host) super host end |
Instance Method Details
#send ⇒ Object
9 10 11 12 13 |
# File 'lib/zombie_check/ping/ping_sender/unix_ping.rb', line 9 def send result = `ping -c 1 -W 5 #{host}`.match(/time=(\d+\.?\d*)/) self.duration = result[1].to_f / 1000 if result self end |