I guess you already know the algebra package of Shin-ichiro HARA:

http://blade.nagaokaut.ac.jp/~sinara/ruby/math

From the README:

Preface

This is a library for mathematical computations. Our purpose is to express
the
mathematical object naturally in Ruby. Though it is not operated fast, we
can
see the algorithm of the mathematical processing not in black box but in
scripts.

This library is in development stage. At present, things we can handle are
as
follows:

 - One-variate polynomial
      Fundamental operations (addition, multiplication,
quotient/remainder,
        ...)
      factorization

 - Multi-variate polynomial
      Fundamental operations (addition, multiplication, ...)
      Creating Groebner-basis, quotient/remainder by Groebner-basis.

 - Algebraic systems
      Creating quotient fields
      Creating residue class fields
      Operating matrices.
   --
Horst