[前][次][番号順一覧][スレッド一覧]

ruby-changes:46358

From: eregon <ko1@a...>
Date: Tue, 25 Apr 2017 18:10:49 +0900 (JST)
Subject: [ruby-changes:46358] eregon:r58472 (trunk): Document the Warning module and warn method

eregon	2017-04-25 18:10:46 +0900 (Tue, 25 Apr 2017)

  New Revision: 58472

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=58472

  Log:
    Document the Warning module and warn method
    
    * error.c (Warning): add documentation. [Feature #13504]
      Author: Jeremy Evans <code@j...>

  Modified files:
    trunk/error.c
Index: error.c
===================================================================
--- error.c	(revision 58471)
+++ error.c	(revision 58472)
@@ -136,6 +136,15 @@ ruby_deprecated_internal_feature(const c https://github.com/ruby/ruby/blob/trunk/error.c#L136
     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) https://github.com/ruby/ruby/blob/trunk/error.c#L154
     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)
 {

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]