I am pleased to announce a new RubyForge project I call CreditCard ( 
http://rubyforge.org/projects/creditcard/ ). This is a small hint of 
what is to come, a full payment processing gateway for Ruby. To try it 
out, type:

gem install creditcard

These subroutines tell you whether a credit card number is 
self-consistent using known algorithms for credit card numbers. All 
non-integer values are removed from the string before parsing so that 
you don?t have to worry about the format of the string.

Here are some example uses.

"5276 4400 6542 1319".creditcard?
       => true

  puts 5276440065421319.creditcard_type
       => "mastercard"

  "5276440065421319".creditcard? "visa"
       => false

  "5276-4400-6542-1319".creditcard? "mastercard"
       => true

-Lucas
http://www.rufy.com/