From: "Derrick B." Date: 2012-12-21T14:58:39+09:00 Subject: Re: Perl to Ruby: regex captures to assignment. botp wrote in post #1089780: > On Fri, Dec 21, 2012 at 12:59 PM, Derrick B. wrote: >>....Lastly, my code I posted did not convert terms to improper > fractions,... > > not to answer your questions, but, i'd probably go a different route > ... > > eg, > > require 'rational' > ["1 3/4", "-2 1/2", "5/8", "-1/3", "5", "-5"].map do |mix| > mix.split.map{|x| Rational(x)} > end > > => [ [(1/1), (3/4)], [(-2/1), (1/2)], [(5/8)], [(-1/3)], [(5/1)], > [(-5/1)] ] > > kind regards -botp Interesting! Coming from Perl, I figured there would be a gem to handle fractions. Thanks! -- Posted via http://www.ruby-forum.com/.