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

ruby-changes:54429

From: nobu <ko1@a...>
Date: Sun, 30 Dec 2018 08:40:19 +0900 (JST)
Subject: [ruby-changes:54429] nobu:r66644 (trunk): Update NoMethodError/NameError docs [ci skip]

nobu	2018-12-30 08:40:15 +0900 (Sun, 30 Dec 2018)

  New Revision: 66644

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

  Log:
    Update NoMethodError/NameError docs [ci skip]
    
    [ruby-core:90796] [Bug #15481]
    
    From: zverok (Victor Shepelev) <zverok.offline@g...>

  Modified files:
    trunk/error.c
Index: error.c
===================================================================
--- error.c	(revision 66643)
+++ error.c	(revision 66644)
@@ -1451,12 +1451,15 @@ name_err_init_attr(VALUE exc, VALUE recv https://github.com/ruby/ruby/blob/trunk/error.c#L1451
 
 /*
  * call-seq:
- *   NameError.new(msg [, name])  -> name_error
- *   NameError.new(msg [, name], receiver:)  -> name_error
+ *   NameError.new(msg=nil, name=nil, receiver: nil)  -> name_error
  *
  * Construct a new NameError exception. If given the <i>name</i>
  * parameter may subsequently be examined using the <code>NameError#name</code>
- * method.
+ * method. <i>receiver</i> parameter allows to pass object in
+ * context of which the error happened. Example:
+ *
+ *    [1, 2, 3].method(:rject) # NameError with name "rject" and receiver: Array
+ *    [1, 2, 3].singleton_method(:rject) # NameError with name "rject" and receiver: [1, 2, 3]
  */
 
 static VALUE
@@ -1535,12 +1538,18 @@ nometh_err_init_attr(VALUE exc, VALUE ar https://github.com/ruby/ruby/blob/trunk/error.c#L1538
 
 /*
  * call-seq:
- *   NoMethodError.new([msg, *, name [, args [, priv]]])  -> no_method_error
+ *   NoMethodError.new(msg=nil, name=nil, args=nil, private=false, receiver: nil)  -> no_method_error
  *
  * Construct a NoMethodError exception for a method of the given name
  * called with the given arguments. The name may be accessed using
  * the <code>#name</code> method on the resulting object, and the
  * arguments using the <code>#args</code> method.
+ *
+ * If <i>private</i> argument were passed, it designates method was
+ * attempted to call in private context, and can be accessed with
+ * <code>#private_call?</code> method.
+ *
+ * <i>receiver</i> argument stores an object whose method was called.
  */
 
 static VALUE

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

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