Issue #10365 has been updated by Jeremy Evans.


Wouldn't the proposed Rational#to_a break backwards compatibility, as well as consistency with other numeric classes:

Currently:

Array(1) # => [1]
Array(1.0) # => [1.0]
Array(BigDecimal.new('1.0')) # => [#<BigDecimal:12c032467878,'0.1E1',9(18)>]
Array(Complex(1, 2)) => [(1+2i)]
Array(1/2r) # => [(1/2)]

With proposed method:

Array(1/2r) # => [1, 2]

----------------------------------------
Feature #10365: `Rational#to_a` and `Array#to_r`
https://bugs.ruby-lang.org/issues/10365#change-49347

* Author: Tsuyoshi Sawada
* Status: Open
* Priority: Normal
* Assignee: 
* Category: 
* Target version: 
----------------------------------------
I guess people would want to extract the numerator and the denominator of an array. `to_a` would perhaps be a good name:

    (2/51).to_a # => [2, 51]

It also might be useful if `Array#to_r` were provided as an alternative way to create a rational from an array:

    [4, 6].to_r #=> (2/3)

This would be equivalent to `Rational(*[4, 6])`.



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