Get rid of LoadError with $DEBUG

This commit is contained in:
Nobuyoshi Nakada 2019-07-17 14:45:33 +09:00
Родитель af07e07ac9
Коммит cd372f8db2
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4BC7D6DF58D8DF60
1 изменённых файлов: 7 добавлений и 6 удалений

Просмотреть файл

@ -166,13 +166,14 @@ class Resolv
# Resolv::Hosts is a hostname resolver that uses the system hosts file. # Resolv::Hosts is a hostname resolver that uses the system hosts file.
class Hosts class Hosts
begin if /mswin|mingw|cygwin/ =~ RUBY_PLATFORM and
raise LoadError unless /mswin|mingw|cygwin/ =~ RUBY_PLATFORM begin
require 'win32/resolv' require 'win32/resolv'
DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL DefaultFileName = Win32::Resolv.get_hosts_path || IO::NULL
rescue LoadError rescue LoadError
DefaultFileName = '/etc/hosts' end
end end
DefaultFileName ||= '/etc/hosts'
## ##
# Creates a new Resolv::Hosts, using +filename+ for its data source. # Creates a new Resolv::Hosts, using +filename+ for its data source.