summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-21 00:45:52 (GMT)
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-03-21 00:45:52 (GMT)
commitcbf4eca61e1b051593b5d29c657546260247e785 (patch)
tree0eed92e27f9894b160e4f73360e0730e3614f379
parent3fb752a921a56fb4ea3188fb12f02f6a5749480e (diff)
* complax.c: [DOC] Document number conversion of `nil` by @skade [fix GH-570] [ci skip]
* object.c, rational.c: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@45375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--complex.c2
-rw-r--r--object.c4
-rw-r--r--rational.c2
3 files changed, 7 insertions, 1 deletions
diff --git a/complex.c b/complex.c
index 78c4259..761b70c 100644
--- a/complex.c
+++ b/complex.c
@@ -431,6 +431,8 @@ f_complex_new2(VALUE klass, VALUE x, VALUE y)
*
* Complex(1, 2) #=> (1+2i)
* Complex('1+2i') #=> (1+2i)
+ * Complex(nil) #=> TypeError
+ * Complex(1, nil) #=> TypeError
*
* Syntax of string form:
*
diff --git a/object.c b/object.c
index e3e6a7d..7dc5407 100644
--- a/object.c
+++ b/object.c
@@ -2746,13 +2746,15 @@ rb_Integer(VALUE val)
* 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
diff --git a/rational.c b/rational.c
index c035a1a..be1c9d1 100644
--- a/rational.c
+++ b/rational.c
@@ -584,6 +584,8 @@ f_rational_new_no_reduce2(VALUE klass, VALUE x, VALUE y)
*
* Rational(1, 2) #=> (1/2)
* Rational('1/2') #=> (1/2)
+ * Rational(nil) #=> TypeError
+ * Rational(1, nil) #=> TypeError
*
* Syntax of string form:
*