Issue #12485 has been updated by Kenta Murata.

File rational.c.diff added

Attached patch can fix this issue.

----------------------------------------
Bug #12485: Kernel.Rational raises TypeError though given denominator returns 1 by to_int
https://bugs.ruby-lang.org/issues/12485#change-59198

* Author: Kenta Murata
* Status: Open
* Priority: Normal
* Assignee: 
* 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)


-- 
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>