We do regressions with rb-gsl.
require 'gsl'
x = GSL::Vector.alloc(array_of_x_values)
y = GSL::Vector.alloc(array_of_y_values)
c0, c1, cov00, cov01, cov11, chisq, status = GSL::Fit::linear(x, y)
It's not nearly as much work, and it's much faster than doing it in pure Ruby. :)(It also does weighted regressions and exponential fitting, among a host of other things. That wheel's gone done been invented already.)