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

ruby-changes:33296

From: hsbt <ko1@a...>
Date: Fri, 21 Mar 2014 09:45:59 +0900 (JST)
Subject: [ruby-changes:33296] hsbt:r45375 (trunk): * complax.c: [DOC] Document number conversion of `nil` by @skade [fix GH-570] [ci skip]

hsbt	2014-03-21 09:45:52 +0900 (Fri, 21 Mar 2014)

  New Revision: 45375

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=45375

  Log:
    * complax.c: [DOC] Document number conversion of `nil` by @skade [fix GH-570] [ci skip]
    
    * object.c, rational.c: ditto.

  Modified files:
    trunk/complex.c
    trunk/object.c
    trunk/rational.c
Index: complex.c
===================================================================
--- complex.c	(revision 45374)
+++ complex.c	(revision 45375)
@@ -431,6 +431,8 @@ f_complex_new2(VALUE klass, VALUE x, VAL https://github.com/ruby/ruby/blob/trunk/complex.c#L431
  *
  *    Complex(1, 2)    #=> (1+2i)
  *    Complex('1+2i')  #=> (1+2i)
+ *    Complex(nil)     #=> TypeError
+ *    Complex(1, nil)  #=> TypeError
  *
  * Syntax of string form:
  *
Index: object.c
===================================================================
--- object.c	(revision 45374)
+++ object.c	(revision 45375)
@@ -2746,13 +2746,15 @@ rb_Integer(VALUE val) https://github.com/ruby/ruby/blob/trunk/object.c#L2746
  *  In any case, strings should be strictly conformed to numeric
  *  representation. This behavior is different from that of
  *  <code>String#to_i</code>.  Non string values will be converted using
- *  <code>to_int</code>, and <code>to_i</code>.
+ *  <code>to_int</code>, and <code>to_i</code>. Passing <code>nil</code>
+ *  raises a TypeError.
  *
  *     Integer(123.999)    #=> 123
  *     Integer("0x1a")     #=> 26
  *     Integer(Time.new)   #=> 1204973019
  *     Integer("0930", 10) #=> 930
  *     Integer("111", 2)   #=> 7
+ *     Integer(nil)        #=> TypeError
  */
 
 static VALUE
Index: rational.c
===================================================================
--- rational.c	(revision 45374)
+++ rational.c	(revision 45375)
@@ -584,6 +584,8 @@ f_rational_new_no_reduce2(VALUE klass, V https://github.com/ruby/ruby/blob/trunk/rational.c#L584
  *
  *    Rational(1, 2)   #=> (1/2)
  *    Rational('1/2')  #=> (1/2)
+ *    Rational(nil)    #=> TypeError
+ *    Rational(1, nil) #=> TypeError
  *
  * Syntax of string form:
  *

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

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