Method: Net::Ping#ping

Defined in:
lib/external/ping/ping.rb

#ping(host = @host) ⇒ Object Also known as: ping?, pingecho

The default interface for the Net::Ping#ping method. Each subclass should call super() before continuing with their own implementation in order to ensure that the @exception and @warning instance variables are reset.

If host is nil here, then it will use the host specified in the constructor. If the host is nil and there was no host specified in the constructor then an ArgumentError is raised. – The @duration should be set in the subclass’ ping method.

Raises:



79
80
81
82
83
84
# File 'lib/external/ping/ping.rb', line 79

def ping(host = @host)
   raise ArgumentError, 'no host specified' unless host
   @exception = nil
   @warning   = nil
   @duration  = nil
end