aboutsummaryrefslogtreecommitdiffstats
path: root/lib/ipaddr.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/ipaddr.rb')
-rw-r--r--lib/ipaddr.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb
index b8befe8499..79ea0d6245 100644
--- a/lib/ipaddr.rb
+++ b/lib/ipaddr.rb
@@ -32,6 +32,18 @@
require 'socket'
+unless Socket.const_defined? "AF_INET6"
+ class Socket
+ AF_INET6 = Object.new
+ end
+ class << IPSocket
+ alias getaddress_orig getaddress
+ def getaddress(s)
+ /^::/ =~ s ? s : getaddress_orig(s)
+ end
+ end
+end
+
# IPAddr provides a set of methods to manipulate an IP address. Both
# IPv4 and IPv6 are supported.
class IPAddr