Issue #13992 has been updated by shevegen (Robert A. Heiler).


Docu is at:

https://ruby-doc.org/core/Kernel.html#method-i-Integer

Perhaps the octal-notation could also be put into the documentation there.

And an example could be added for octal-input leading to error such as the
above. That would help explain things to newcomers who may be surprised
about the behaviour.

----------------------------------------
Bug #13992: Strange behaviour for kernel#integer method
https://bugs.ruby-lang.org/issues/13992#change-67138

* Author: Ursus (Ivan Lasorsa)
* Status: Open
* Priority: Normal
* Assignee: 
* Target version: 
* ruby -v: 2.4.1
* Backport: 2.3: UNKNOWN, 2.4: UNKNOWN
----------------------------------------
I tried this one with ruby 2.3.1 and ruby 2.4.1.

~~~ ruby
Integer('04')
4
Integer('05')
5
Integer('08')
ArgumentError: invalid value for Integer(): "08"
Integer('09')
ArgumentError: invalid value for Integer(): "09"
~~~

Does this makes sense?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>