Class: IPSocket
- Inherits:
-
Object
- Object
- IPSocket
- Defined in:
- lib/ipaddr.rb
Class Method Summary collapse
-
.getaddress(s) ⇒ Object
Returns a
String
based representation of a valid DNS hostname, IPv4 or IPv6 address.
Class Method Details
.getaddress(s) ⇒ Object
Returns a String
based representation of a valid DNS hostname, IPv4 or IPv6 address.
IPSocket.getaddress 'localhost' #=> "::1"
IPSocket.getaddress 'broadcasthost' #=> "255.255.255.255"
IPSocket.getaddress 'www.ruby-lang.org' #=> "221.186.184.68"
IPSocket.getaddress 'www.ccc.de' #=> "2a00:1328:e102:ccc0::122"
833 834 835 836 837 838 839 |
# File 'lib/ipaddr.rb', line 833 def getaddress(s) if valid_v6?(s) s else getaddress_orig(s) end end |