summaryrefslogtreecommitdiff
path: root/object.c
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-16 00:07:37 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2020-12-16 00:07:37 +0900
commita039dc018ccf34e217f767eac500b9400c58f069 (patch)
tree1d67f58ef62a0e68183c4dbc28382446038d0689 /object.c
parentefc6a4e580b863ee032d61a7f3927be86de64a03 (diff)
[DOC] Described "numeric representation" more precisely [ci skip]
[Bug #17395]
Diffstat (limited to 'object.c')
-rw-r--r--object.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/object.c b/object.c
index 7343bd6d1c..552b10ba49 100644
--- a/object.c
+++ b/object.c
@@ -3372,8 +3372,9 @@ rb_opts_exception_p(VALUE opts, int default_value)
* integer string representation. If <i>arg</i> is a String,
* when <i>base</i> is omitted or equals zero, radix indicators
* (<code>0</code>, <code>0b</code>, and <code>0x</code>) are honored.
- * In any case, strings should be strictly conformed to numeric
- * representation. This behavior is different from that of
+ * In any case, strings should consist only of one or more digits, except
+ * for that a sign, one underscore between two digits, and leading/trailing
+ * spaces are optional. This behavior is different from that of
* String#to_i. Non string values will be converted by first
* trying <code>to_int</code>, then <code>to_i</code>.
*
@@ -3387,6 +3388,7 @@ rb_opts_exception_p(VALUE opts, int default_value)
* Integer(Time.new) #=> 1204973019
* Integer("0930", 10) #=> 930
* Integer("111", 2) #=> 7
+ * Integer(" +1_0 ") #=> 10
* Integer(nil) #=> TypeError: can't convert nil into Integer
* Integer("x") #=> ArgumentError: invalid value for Integer(): "x"
*