diff --git a/ext/openssl/lib/openssl/ssl.rb b/ext/openssl/lib/openssl/ssl.rb index a628648e71..fb143c9408 100644 --- a/ext/openssl/lib/openssl/ssl.rb +++ b/ext/openssl/lib/openssl/ssl.rb @@ -201,7 +201,7 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3 if /(?_client|_server)\z/ =~ meth meth = $` if $VERBOSE - warn "#{caller(1)[0]}: method type #{type.inspect} is ignored" + warn "#{caller(1, 1)[0]}: method type #{type.inspect} is ignored" end end version = METHODS_MAP[meth.intern] or diff --git a/lib/delegate.rb b/lib/delegate.rb index c5a94a5d31..71aff40f7f 100644 --- a/lib/delegate.rb +++ b/lib/delegate.rb @@ -97,7 +97,7 @@ class Delegator < BasicObject target = self.__getobj__ {r = false} r &&= target.respond_to?(m, include_private) if r && include_private && !target.respond_to?(m, false) - warn "#{caller(3)[0]}: delegator does not forward private method \##{m}" + warn "#{caller(3, 1)[0]}: delegator does not forward private method \##{m}" return false end r diff --git a/lib/ipaddr.rb b/lib/ipaddr.rb index ecf28ebb25..0f3a5e2878 100644 --- a/lib/ipaddr.rb +++ b/lib/ipaddr.rb @@ -310,7 +310,7 @@ class IPAddr # Returns true if the ipaddr is an IPv4-compatible IPv6 address. def ipv4_compat? - warn "#{caller(1)[0]}: warning: IPAddr\##{__callee__} is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: IPAddr\##{__callee__} is obsolete" if $VERBOSE _ipv4_compat? end @@ -336,7 +336,7 @@ class IPAddr # Returns a new ipaddr built by converting the native IPv4 address # into an IPv4-compatible IPv6 address. def ipv4_compat - warn "#{caller(1)[0]}: warning: IPAddr\##{__callee__} is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: IPAddr\##{__callee__} is obsolete" if $VERBOSE if !ipv4? raise InvalidAddressError, "not an IPv4 address" end diff --git a/lib/matrix.rb b/lib/matrix.rb index 77c35b3475..3a049dda9f 100644 --- a/lib/matrix.rb +++ b/lib/matrix.rb @@ -1246,7 +1246,7 @@ class Matrix # deprecated; use Matrix#determinant # def determinant_e - warn "#{caller(1)[0]}: warning: Matrix#determinant_e is deprecated; use #determinant" + warn "#{caller(1, 1)[0]}: warning: Matrix#determinant_e is deprecated; use #determinant" determinant end alias det_e determinant_e @@ -1304,7 +1304,7 @@ class Matrix # deprecated; use Matrix#rank # def rank_e - warn "#{caller(1)[0]}: warning: Matrix#rank_e is deprecated; use #rank" + warn "#{caller(1, 1)[0]}: warning: Matrix#rank_e is deprecated; use #rank" rank end @@ -1490,17 +1490,17 @@ class Matrix end def elements_to_f - warn "#{caller(1)[0]}: warning: Matrix#elements_to_f is deprecated, use map(&:to_f)" + warn "#{caller(1, 1)[0]}: warning: Matrix#elements_to_f is deprecated, use map(&:to_f)" map(&:to_f) end def elements_to_i - warn "#{caller(1)[0]}: warning: Matrix#elements_to_i is deprecated, use map(&:to_i)" + warn "#{caller(1, 1)[0]}: warning: Matrix#elements_to_i is deprecated, use map(&:to_i)" map(&:to_i) end def elements_to_r - warn "#{caller(1)[0]}: warning: Matrix#elements_to_r is deprecated, use map(&:to_r)" + warn "#{caller(1, 1)[0]}: warning: Matrix#elements_to_r is deprecated, use map(&:to_r)" map(&:to_r) end @@ -2142,17 +2142,17 @@ class Vector end def elements_to_f - warn "#{caller(1)[0]}: warning: Vector#elements_to_f is deprecated" + warn "#{caller(1, 1)[0]}: warning: Vector#elements_to_f is deprecated" map(&:to_f) end def elements_to_i - warn "#{caller(1)[0]}: warning: Vector#elements_to_i is deprecated" + warn "#{caller(1, 1)[0]}: warning: Vector#elements_to_i is deprecated" map(&:to_i) end def elements_to_r - warn "#{caller(1)[0]}: warning: Vector#elements_to_r is deprecated" + warn "#{caller(1, 1)[0]}: warning: Vector#elements_to_r is deprecated" map(&:to_r) end diff --git a/lib/net/http/response.rb b/lib/net/http/response.rb index 1351d7b2d2..ee02f4be4a 100644 --- a/lib/net/http/response.rb +++ b/lib/net/http/response.rb @@ -140,17 +140,17 @@ class Net::HTTPResponse # def response #:nodoc: - warn "#{caller(1)[0]}: warning: Net::HTTPResponse#response is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: Net::HTTPResponse#response is obsolete" if $VERBOSE self end def header #:nodoc: - warn "#{caller(1)[0]}: warning: Net::HTTPResponse#header is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: Net::HTTPResponse#header is obsolete" if $VERBOSE self end def read_header #:nodoc: - warn "#{caller(1)[0]}: warning: Net::HTTPResponse#read_header is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: Net::HTTPResponse#read_header is obsolete" if $VERBOSE self end diff --git a/lib/uri/common.rb b/lib/uri/common.rb index 74bbdea0a4..a082c2a918 100644 --- a/lib/uri/common.rb +++ b/lib/uri/common.rb @@ -100,7 +100,7 @@ module URI # # => "@%3F@%21" # def escape(*arg) - warn "#{caller(1)[0]}: warning: URI.escape is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: URI.escape is obsolete" if $VERBOSE DEFAULT_PARSER.escape(*arg) end alias encode escape @@ -132,7 +132,7 @@ module URI # # => "http://example.com/?a=\t\r" # def unescape(*arg) - warn "#{caller(1)[0]}: warning: URI.unescape is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: URI.unescape is obsolete" if $VERBOSE DEFAULT_PARSER.unescape(*arg) end alias decode unescape @@ -300,7 +300,7 @@ module URI # # => ["http://foo.example.com/bla", "mailto:test@example.com"] # def self.extract(str, schemes = nil, &block) - warn "#{caller(1)[0]}: warning: URI.extract is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: URI.extract is obsolete" if $VERBOSE DEFAULT_PARSER.extract(str, schemes, &block) end @@ -336,7 +336,7 @@ module URI # end # def self.regexp(schemes = nil) - warn "#{caller(1)[0]}: warning: URI.regexp is obsolete" if $VERBOSE + warn "#{caller(1, 1)[0]}: warning: URI.regexp is obsolete" if $VERBOSE DEFAULT_PARSER.make_regexp(schemes) end diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb index afdd5de00b..761fe92df8 100644 --- a/test/lib/test/unit.rb +++ b/test/lib/test/unit.rb @@ -842,7 +842,7 @@ module Test begin require "rbconfig" rescue LoadError - warn "#{caller(1)[0]}: warning: Parallel running disabled because can't get path to ruby; run specify with --ruby argument" + warn "#{caller(1, 1)[0]}: warning: Parallel running disabled because can't get path to ruby; run specify with --ruby argument" options[:parallel] = nil else options[:ruby] ||= [RbConfig.ruby]