From: Joel VanderWerf Date: 2008-05-21T00:34:54+09:00 Subject: Re: Why is Array#to_f not defined? Fredrik wrote: > Ruby (1.8.6) seems to be missing numeric conversion methods for > Arrays : > > class Array > def to_f > self.map { |i| i.to_f } > end > end > > (and the same for to_i) > Did somebody forget to include that? :) Surely there is no reason to > NOT have this method for the Array class. > > /Fredrik Maybe someone expects this: class Array def to_f Float("#{at(0)}.#{at(1)}E#{at(2)}") end end p [2, "0001", 123].to_f # ==> 2.0001e+123 -- vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407