Cullen J O'Neill asked
> I have a string of numbers like:
>  
> "2 3 3.5 5 1.2"
>  
> What's the best way to convert this into an array like:
>  
> [ 2, 3, 3.5, 5, 1.2 ]

Dunno about best way, but this worked on the first run:

  ruby -e'p "2 3 3.5 5 1.2".split.collect { |number| 
     (number =~ /\./ ? number.to_f : number.to_i) }'

Outputting:

    [2, 3, 3.5, 5, 1.2]

I wonder if there's enough need to introduce String#to_n doing basically the
thing above.

 	- Aleksi