File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
Expand file tree Collapse file tree 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
173173
174174 class ResolvTimeout < Timeout ::Error ; end
175175
176+ WINDOWS = /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig ::CONFIG [ 'host_os' ] =~ /mswin/
177+ private_constant :WINDOWS
178+
176179 ##
177180 # Resolv::Hosts is a hostname resolver that uses the system hosts file.
178181
179182 class Hosts
180- if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM and
183+ if WINDOWS
181184 begin
182185 require 'win32/resolv'
183186 DefaultFileName = Win32 ::Resolv . get_hosts_path || IO ::NULL
@@ -1019,7 +1022,7 @@ def Config.default_config_hash(filename="/etc/resolv.conf")
10191022 if File . exist? filename
10201023 config_hash = Config . parse_resolv_conf ( filename )
10211024 else
1022- if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM
1025+ if WINDOWS
10231026 require 'win32/resolv'
10241027 search , nameserver = Win32 ::Resolv . get_resolv_info
10251028 config_hash = { }
You can’t perform that action at this time.
0 commit comments