<img src=“https://secure.travis-ci.org/alovak/bank_card.png?branch=master” alt=“Build Status” />
This gem contains
-
validation methods to check card number with Luhn method, card expiration date
-
brand detection method for Visa, MasterCard, JCB, Discover, Maestro, Diners Club, American Express.
class CreditCard < ActiveRecord::Base include BankCard::Validations include BankCard::Brands validates :number, :luhn => true validates_expiration_of :date before_create :set_brand private def set_brand self.brand = detect_brand(number) end end
You can get more info from specs
released under the MIT license.