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