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 arg is a String, * when base is omitted or equals zero, radix indicators * (0, 0b, and 0x) 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 to_int, then to_i. * @@ -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" *