Simplify handling of a LoadError

The `LoadError` has a `path` reader in all supported rubies.
This commit is contained in:
David Rodríguez 2020-06-16 13:14:32 +02:00 committed by Hiroshi SHIBATA
parent e0337ce597
commit 967dba157c
Notes: git 2020-06-17 21:17:28 +09:00

View File

@ -5,8 +5,7 @@ require 'webrick'
begin begin
require 'webrick/https' require 'webrick/https'
rescue LoadError => e rescue LoadError => e
raise unless (e.respond_to?(:path) && e.path == 'openssl') || raise unless e.path == 'openssl'
e.message =~ / -- openssl$/
end end
unless defined?(OpenSSL::SSL) unless defined?(OpenSSL::SSL)