From: muraken@... Date: 2020-10-22T06:12:22+00:00 Subject: [ruby-core:100495] [Ruby master Bug#12485] Kernel.Rational raises TypeError though given denominator returns 1 by to_int Issue #12485 has been updated by mrkn (Kenta Murata). Assignee set to mrkn (Kenta Murata) Status changed from Open to Assigned I'm working on this at https://github.com/ruby/ruby/pull/3684 ---------------------------------------- Bug #12485: Kernel.Rational raises TypeError though given denominator returns 1 by to_int https://bugs.ruby-lang.org/issues/12485#change-88114 * Author: mrkn (Kenta Murata) * Status: Assigned * Priority: Normal * Assignee: mrkn (Kenta Murata) * ruby -v: ruby 2.3.1p112 (2016-04-26 revision 54768) [x86_64-darwin15] * Backport: 2.1: UNKNOWN, 2.2: UNKNOWN, 2.3: UNKNOWN ---------------------------------------- Is it an intentional behavior? ```ruby class << (o = Object.new) def to_int 1 end end Rational(1, o) #=> TypeError: not an integer ``` ---Files-------------------------------- rational.c.diff (539 Bytes) rational-denom-to_int.patch (1.73 KB) -- https://bugs.ruby-lang.org/ Unsubscribe: