File tree 1 file changed +5
-2
lines changed
1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -173,11 +173,14 @@ class ResolvError < StandardError; end
173
173
174
174
class ResolvTimeout < Timeout ::Error ; end
175
175
176
+ WINDOWS = /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig ::CONFIG [ 'host_os' ] =~ /mswin/
177
+ private_constant :WINDOWS
178
+
176
179
##
177
180
# Resolv::Hosts is a hostname resolver that uses the system hosts file.
178
181
179
182
class Hosts
180
- if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM and
183
+ if WINDOWS
181
184
begin
182
185
require 'win32/resolv'
183
186
DefaultFileName = Win32 ::Resolv . get_hosts_path || IO ::NULL
@@ -1019,7 +1022,7 @@ def Config.default_config_hash(filename="/etc/resolv.conf")
1019
1022
if File . exist? filename
1020
1023
config_hash = Config . parse_resolv_conf ( filename )
1021
1024
else
1022
- if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM
1025
+ if WINDOWS
1023
1026
require 'win32/resolv'
1024
1027
search , nameserver = Win32 ::Resolv . get_resolv_info
1025
1028
config_hash = { }
You can’t perform that action at this time.
0 commit comments