aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authorkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-24 00:03:51 +0000
committerkazu <kazu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-01-24 00:03:51 +0000
commita89823d932b16ae81ee031bf9fc0b3a9f9d5e850 (patch)
treea13eeb9551570642bfb15b7c0bbde6d92a4e0127 /error.c
parented1f6b2f1a12ef5e4b4f42f706f07b63b8c3721d (diff)
downloadruby-a89823d932b16ae81ee031bf9fc0b3a9f9d5e850.tar.gz
Add documentation for the Kernel#warn :uplevel keyword
[ruby-core:84574] [Bug #14264] Author: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62018 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c19
1 files changed, 19 insertions, 0 deletions
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 <code>:uplevel</code> keyword is given, the string will
+ * be prepended with information for the given caller frame in
+ * the same format used by the <code>rb_warn</code> C function.
+ *
+ * # In baz.rb
+ * def foo
+ * warn("invalid call to foo", uplevel: 1)
+ * end
+ *
+ * def bar
+ * foo
+ * end
+ *
+ * bar
+ *
+ * <em>produces:</em>
+ *
+ * baz.rb:6: warning: invalid call to foo
*/
static VALUE