Skip to content

alovak/bank_card

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

<img src=“https://secure.travis-ci.org/alovak/bank_card.png?branch=master” alt=“Build Status” />

BankCard / CreditCard

Description

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.

Example

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

Licence

released under the MIT license.

About

Credit card validations and useful methods

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages