https://bugs.ruby-lang.org/https://bugs.ruby-lang.org/favicon.ico?17113305112023-01-17T18:07:48ZRuby Issue Tracking SystemRuby master - Bug #19349: Kernel.Integer silently discards base argument that does not have a #to_inthttps://bugs.ruby-lang.org/issues/19349?journal_id=1012712023-01-17T18:07:48Zherwin (Herwin W)
<ul></ul><p>And likely related: in case the output of the call to <code>to_int</code> returns something that is not an integer, it gets discarded as well</p>
<pre><code>Kernel.Integer('10', Object.new.tap { |x| x.define_singleton_method(:to_int) { '8' } })
=> 10
</code></pre> Ruby master - Bug #19349: Kernel.Integer silently discards base argument that does not have a #to_inthttps://bugs.ruby-lang.org/issues/19349?journal_id=1012812023-01-18T03:27:42Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul></ul><p><a href="https://github.com/ruby/ruby/pull/7144" class="external">https://github.com/ruby/ruby/pull/7144</a></p> Ruby master - Bug #19349: Kernel.Integer silently discards base argument that does not have a #to_inthttps://bugs.ruby-lang.org/issues/19349?journal_id=1044282023-08-31T13:06:20Znobu (Nobuyoshi Nakada)nobu@ruby-lang.org
<ul><li><strong>Status</strong> changed from <i>Open</i> to <i>Closed</i></li></ul><p>Applied in changeset <a class="changeset" title="[Bug #19349] Respect `#to_int` of `base` argument" href="https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/c45176dbca2bd082cb199e9411e4dfc5ec162352">git|c45176dbca2bd082cb199e9411e4dfc5ec162352</a>.</p>
<hr>
<p>[Bug <a class="issue tracker-1 status-5 priority-4 priority-default closed" title="Bug: Kernel.Integer silently discards base argument that does not have a #to_int (Closed)" href="https://bugs.ruby-lang.org/issues/19349">#19349</a>] Respect <code>#to_int</code> of <code>base</code> argument</p>