aboutsummaryrefslogtreecommitdiffstats
path: root/error.c
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-25 09:10:46 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-04-25 09:10:46 +0000
commitcb6be8f33e300e38c7a6ff8503c53cfc601980ba (patch)
treed944a79b21e8d87e1c1b1bbf024e3036050fef75 /error.c
parent51130a40f8cbcd076db4148c3b4ef67b4a1502bd (diff)
downloadruby-cb6be8f33e300e38c7a6ff8503c53cfc601980ba.tar.gz
Document the Warning module and warn method
* error.c (Warning): add documentation. [Feature #13504] Author: Jeremy Evans <code@jeremyevans.net> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58472 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'error.c')
-rw-r--r--error.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/error.c b/error.c
index 45106de851..0ca6544bac 100644
--- a/error.c
+++ b/error.c
@@ -136,6 +136,15 @@ ruby_deprecated_internal_feature(const char *func)
rb_fatal("%s is only for internal use and deprecated; do not use", func);
}
+/*
+ * call-seq:
+ * warn(msg) -> nil
+ *
+ * Writes warning message to $stderr, followed by a newline
+ * if the message does not end in a newline. This method is called
+ * by ruby for all emitted warnings.
+ */
+
static VALUE
rb_warning_s_warn(VALUE mod, VALUE str)
{
@@ -145,6 +154,22 @@ rb_warning_s_warn(VALUE mod, VALUE str)
return Qnil;
}
+/*
+ * Document-module: Warning
+ *
+ * The Warning module contains a single method named #warn, and the
+ * module extends itself, making Warning.warn available.
+ * Warning.warn is called for all warnings issued by ruby.
+ * By default, warnings are printed to $stderr.
+ *
+ * By overriding Warning.warn, you can change how warnings are
+ * handled by ruby, either filtering some warnings, and/or outputing
+ * warnings somewhere other than $stderr. When Warning.warn is
+ * overridden, super can be called to get the default behavior of
+ * printing the warning to $stderr.
+ *
+ */
+
VALUE
rb_warning_warn(VALUE mod, VALUE str)
{