creditcard.rb

Path: creditcard.rb
Last Update: Sat Jan 15 01:55:41 PST 2005

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.

Usage

require "creditcard"

"5276 4400 6542 1319".creditcard?

      => true

puts 5276440065421319.creditcard_type

      => "mastercard"

"5276440065421319".creditcard? "visa"

      => false

"5276-4400-6542-1319".creditcard? "mastercard"

      => true

Ported from the Perl version by Jon Orwant and Ivan Kohler search.cpan.org/~ivan/Business-CreditCard-0.28/CreditCard.pm

Author:Lucas Carlson (lucas@rufy.com)
Copyright:Copyright © 2005 Lucas Carlson
License:Distributes under the same terms as Ruby

Classes and Modules

Module CreditCard

[Validate]