Skip to content

Commit a70341b

Browse files
authored
Merge pull request #75 from headius/jruby_support
Integrate JRuby changes
2 parents c4bfa07 + de95f55 commit a70341b

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

lib/resolv.rb

+5-2
Original file line numberDiff line numberDiff 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 = {}

0 commit comments

Comments
 (0)