about summary refs log tree commit homepage
path: root/lib/yahns/socket_helper.rb
diff options
context:
space:
mode:
Diffstat (limited to 'lib/yahns/socket_helper.rb')
-rw-r--r--lib/yahns/socket_helper.rb4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/yahns/socket_helper.rb b/lib/yahns/socket_helper.rb
index 66df8b0..a74f3f8 100644
--- a/lib/yahns/socket_helper.rb
+++ b/lib/yahns/socket_helper.rb
@@ -8,7 +8,7 @@ module Yahns::SocketHelper # :nodoc:
   def so_reuseport
     if defined?(Socket::SO_REUSEPORT)
       Socket::SO_REUSEPORT
-    elsif RUBY_PLATFORM =~ /linux/
+    elsif RUBY_PLATFORM.include?('linux')
       15 # only tested on x86_64 and i686
     else
       nil
@@ -108,7 +108,7 @@ module Yahns::SocketHelper # :nodoc:
   # returns rfc2732-style (e.g. "[::1]:666") addresses for IPv6
   def tcp_name(sock)
     port, addr = Socket.unpack_sockaddr_in(sock.getsockname)
-    /:/ =~ addr ? "[#{addr}]:#{port}" : "#{addr}:#{port}"
+    addr.include?(':') ? "[#{addr}]:#{port}" : "#{addr}:#{port}"
   end
 
   # Returns the configuration name of a socket as a string.  sock may