Sha256: 52e417398c06d5c4fa425d9f469bf484e42d1c7668bd9e99b725bf8867281c39
Contents?: true
Size: 475 Bytes
Versions: 1
Compression:
Stored size: 475 Bytes
Contents
module Iz class CreditCard REGEX = /^(?:(4[0-9]{12}(?:[0-9]{3})?)|(5[1-5][0-9]{14})|(6(?:011|5[0-9]{2})[0-9]{12})|(3[47][0-9]{13})|(3(?:0[0-5]|[68][0-9])[0-9]{11})|((?:2131|1800|35[0-9]{3})[0-9]{11}))$/ attr_accessor :number def initialize(credit_card_number) self.number = credit_card_number end def valid? Iz::CreditCard.is_credit_card?(number) end def self.is_credit_card?(number) number.to_s =~ REGEX end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
iz-0.0.1 | lib/iz/credit_card.rb |