class CreditCardValidator::CreditCardBrandName
Constants
- CARD_BRANDS
Public Class Methods
verify_card_brand(number)
click to toggle source
# File lib/credit_card_validator/credit_card_brand_name.rb, line 12 def self.verify_card_brand(number) return false unless ValidateCard.card_number_validate(number) CARD_BRANDS.each do |key, value| pattern = Regexp.new(value) if pattern.match?(number.to_s) return key #.to_s.tr("_"," ").capitalize end end end