mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Use caller with length to reduce unused strings
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
4c6eb271dd
commit
dabdec31e4
7 changed files with 20 additions and 20 deletions
|
@ -201,7 +201,7 @@ YoaOffgTf5qxiwkjnlVZQc3whgnEt9FpVMvQ9eknyeGB5KHfayAc3+hUAvI3/Cr3
|
|||
if /(?<type>_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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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]
|
||||
|
|
Loading…
Add table
Reference in a new issue