1
0
Fork 0
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:
nobu 2018-09-24 13:04:40 +00:00
parent fb80f6c7ba
commit d5a7c704ac

View file

@ -7,14 +7,14 @@ if RUBY_VERSION >= "2.5"
Module.new {define_method(:warn, original_warn)}
original_warn = method(:warn)
module_function define_method(:warn) {|message, uplevel: nil|
module_function define_method(:warn) {|*messages, uplevel: nil|
if uplevel
while (loc, = caller_locations(uplevel, 1); loc && loc.path.start_with?(path))
uplevel += 1
end
original_warn.call(message, uplevel: uplevel + 1)
original_warn.call(*messages, uplevel: uplevel)
else
original_warn.call(message)
original_warn.call(*messages)
end
}
end