File tree Expand file tree Collapse file tree 1 file changed +4
-8
lines changed
Expand file tree Collapse file tree 1 file changed +4
-8
lines changed Original file line number Diff line number Diff line change @@ -174,21 +174,18 @@ class ResolvError < StandardError; end
174174
175175 class ResolvTimeout < Timeout ::Error ; end
176176
177- WINDOWS = /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || ::RbConfig ::CONFIG [ 'host_os' ] =~ /mswin/
178- private_constant :WINDOWS
179-
180177 ##
181178 # Resolv::Hosts is a hostname resolver that uses the system hosts file.
182179
183180 class Hosts
184- if WINDOWS
181+ if /mswin|cygwin|mingw|bccwin/ =~ RUBY_PLATFORM || :: RbConfig :: CONFIG [ 'host_os' ] =~ /mswin/
185182 begin
186183 require 'win32/resolv' unless defined? ( Win32 ::Resolv )
187- DefaultFileName = Win32 ::Resolv . get_hosts_path || IO ::NULL
184+ hosts = Win32 ::Resolv . get_hosts_path || IO ::NULL
188185 rescue LoadError
189186 end
190187 end
191- DefaultFileName ||= '/etc/hosts'
188+ DefaultFileName = hosts || '/etc/hosts'
192189
193190 ##
194191 # Creates a new Resolv::Hosts, using +filename+ for its data source.
@@ -1022,8 +1019,7 @@ def Config.parse_resolv_conf(filename)
10221019 def Config . default_config_hash ( filename = "/etc/resolv.conf" )
10231020 if File . exist? filename
10241021 Config . parse_resolv_conf ( filename )
1025- elsif WINDOWS
1026- require 'win32/resolv' unless defined? ( Win32 ::Resolv )
1022+ elsif defined? ( Win32 ::Resolv )
10271023 search , nameserver = Win32 ::Resolv . get_resolv_info
10281024 config_hash = { }
10291025 config_hash [ :nameserver ] = nameserver if nameserver
You can’t perform that action at this time.
0 commit comments