Return to Snippet

Revision: 80603
at March 21, 2020 23:36 by chrisaiv


Updated URL
https://www.chrisjmendez.com/2007/10/21/ruby-validate-a-credit-card/

Updated Code
https://www.chrisjmendez.com/2007/10/21/ruby-validate-a-credit-card/

Revision: 4074
at October 21, 2007 18:37 by chrisaiv


Initial Code
#Checksum Digit, there is an algorithm that checksum must match
#A. Import the libraries
require 'rubygems'
require 'creditcard'

#B. Boolean test as to whether this number is a valid credit card
puts '5276 4400 6542 1319'.creditcard?

#C. Check the type of credit card it is
puts '5276 4400 6542 1319'.creditcard_type

Initial URL


Initial Description
Download the Credit Card Library from Lucas Carlson
user$ sudo gem install creditcard

Initial Title
Validate a Credit Card Number

Initial Tags
ruby, validation

Initial Language
Ruby