From a89823d932b16ae81ee031bf9fc0b3a9f9d5e850 Mon Sep 17 00:00:00 2001 From: kazu Date: Wed, 24 Jan 2018 00:03:51 +0000 Subject: Add documentation for the Kernel#warn :uplevel keyword [ruby-core:84574] [Bug #14264] Author: Jeremy Evans git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- error.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'error.c') diff --git a/error.c b/error.c index d760de2a5f..2aa5169c2b 100644 --- a/error.c +++ b/error.c @@ -323,6 +323,25 @@ warning_write(int argc, VALUE *argv, VALUE buf) * * warning 1 * warning 2 + * + * If the :uplevel keyword is given, the string will + * be prepended with information for the given caller frame in + * the same format used by the rb_warn C function. + * + * # In baz.rb + * def foo + * warn("invalid call to foo", uplevel: 1) + * end + * + * def bar + * foo + * end + * + * bar + * + * produces: + * + * baz.rb:6: warning: invalid call to foo */ static VALUE -- cgit v1.2.3