Class: Net::Ping
- Inherits:
-
Object
- Object
- Net::Ping
- Defined in:
- lib/net/ping.rb
Overview
An abstract base class. Do not instantiate directly.
Direct Known Subclasses
Constant Summary collapse
- VERSION =
"1.1.1"
Instance Attribute Summary collapse
-
#exception ⇒ Object
readonly
Returns the value of attribute exception.
-
#host ⇒ Object
Returns the value of attribute host.
-
#port ⇒ Object
Returns the value of attribute port.
-
#timeout ⇒ Object
Returns the value of attribute timeout.
-
#warning ⇒ Object
readonly
Returns the value of attribute warning.
Instance Method Summary collapse
-
#initialize(host, port = nil, timeout = 5) ⇒ Ping
constructor
A new instance of Ping.
- #ping ⇒ Object
Constructor Details
#initialize(host, port = nil, timeout = 5) ⇒ Ping
Returns a new instance of Ping.
11 12 13 14 15 16 17 18 |
# File 'lib/net/ping.rb', line 11 def initialize(host, port=nil, timeout=5) @host = host @port = port || Socket.getservbyname("echo") || 7 @timeout = timeout @data = "ping" @exception = nil @warning = nil end |
Instance Attribute Details
#exception ⇒ Object (readonly)
Returns the value of attribute exception.
9 10 11 |
# File 'lib/net/ping.rb', line 9 def exception @exception end |
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/net/ping.rb', line 8 def host @host end |
#port ⇒ Object
Returns the value of attribute port.
8 9 10 |
# File 'lib/net/ping.rb', line 8 def port @port end |
#timeout ⇒ Object
Returns the value of attribute timeout.
8 9 10 |
# File 'lib/net/ping.rb', line 8 def timeout @timeout end |
#warning ⇒ Object (readonly)
Returns the value of attribute warning.
9 10 11 |
# File 'lib/net/ping.rb', line 9 def warning @warning end |
Instance Method Details
#ping ⇒ Object
20 21 22 23 |
# File 'lib/net/ping.rb', line 20 def ping @exception = nil @warning = nil end |