Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Use RbConfig instead of deprecated Config in Ruby 1.9.3 #7

Merged
merged 2 commits into from

2 participants

@tosch

Tests passed here using ruby-1.9.2-p290 and ruby-1.9.3-preview1.

Torsten Schö... added some commits
@djberg96 djberg96 merged commit e7fed7e into djberg96:master
@djberg96
Owner

Hm, should line 16 be changed, too?

Oh yes, of course. Sorry for that one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Sep 14, 2011
  1. Prevent deprecation warnings for Config in Ruby 1.9.3

    Torsten Schönebaum authored
  2. Use RbConfig instead of deprecated Config in Ruby 1.9.3.

    Torsten Schönebaum authored
    I forgot one occurence…
This page is out of date. Refresh to see the latest.
Showing with 8 additions and 4 deletions.
  1. +1 −1  Rakefile
  2. +2 −0  lib/net/ping.rb
  3. +5 −3 lib/net/ping/external.rb
View
2  Rakefile
@@ -1,7 +1,7 @@
require 'rake'
require 'rake/clean'
require 'rake/testtask'
-include Config
+include Object.const_defined?(:RbConfig) ? RbConfig : Config
CLEAN.include("**/*.gem", "**/*.rbc")
View
2  lib/net/ping.rb
@@ -11,6 +11,8 @@
require File.join(File.dirname(__FILE__), 'ping/http')
require File.join(File.dirname(__FILE__), 'ping/ldap')
+RbConfig = Config unless Object.const_defined?(:RbConfig)
+
if Config::CONFIG['host_os'] =~ /msdos|mswin|cygwin|mingw|win32|windows/i
require File.join(File.dirname(__FILE__), 'ping/wmi')
end
View
8 lib/net/ping/external.rb
@@ -1,7 +1,9 @@
require 'rbconfig'
require File.join(File.dirname(__FILE__), 'ping')
-if Config::CONFIG['host_os'] =~ /mswin|win32|msdos|cygwin|mingw|windows/i &&
+RbConfig = Config unless Object.const_defined?(:RbConfig)
+
+if RbConfig::CONFIG['host_os'] =~ /mswin|win32|msdos|cygwin|mingw|windows/i &&
RUBY_PLATFORM != 'java'
then
if RUBY_VERSION.to_f < 1.9
@@ -18,7 +20,7 @@ module Net
# The Ping::External class encapsulates methods for external (system) pings.
class Ping::External < Ping
- CWINDOWS = Config::CONFIG['host_os'] =~ /mswin|win32|msdos|cygwin|mingw|windows/i &&
+ CWINDOWS = RbConfig::CONFIG['host_os'] =~ /mswin|win32|msdos|cygwin|mingw|windows/i &&
RUBY_PLATFORM != 'java'
if CWINDOWS
@@ -40,7 +42,7 @@ def ping(host = @host)
bool = false
orig_cp = nil
- case Config::CONFIG['host_os']
+ case RbConfig::CONFIG['host_os']
when /linux|bsd|osx|mach|darwin/i
pstring += "-c 1 #{host}"
when /solaris|sunos/i
Something went wrong with that request. Please try again.