mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Kernel#warn accepts multiple messages
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
fb80f6c7ba
commit
d5a7c704ac
1 changed files with 3 additions and 3 deletions
|
@ -7,14 +7,14 @@ if RUBY_VERSION >= "2.5"
|
||||||
Module.new {define_method(:warn, original_warn)}
|
Module.new {define_method(:warn, original_warn)}
|
||||||
original_warn = method(:warn)
|
original_warn = method(:warn)
|
||||||
|
|
||||||
module_function define_method(:warn) {|message, uplevel: nil|
|
module_function define_method(:warn) {|*messages, uplevel: nil|
|
||||||
if uplevel
|
if uplevel
|
||||||
while (loc, = caller_locations(uplevel, 1); loc && loc.path.start_with?(path))
|
while (loc, = caller_locations(uplevel, 1); loc && loc.path.start_with?(path))
|
||||||
uplevel += 1
|
uplevel += 1
|
||||||
end
|
end
|
||||||
original_warn.call(message, uplevel: uplevel + 1)
|
original_warn.call(*messages, uplevel: uplevel)
|
||||||
else
|
else
|
||||||
original_warn.call(message)
|
original_warn.call(*messages)
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue