class String

String extension for brand detecting and number validation

require 'credit_card_validations/string'
'5274 5763 9425 9961'.credit_card_brand
'5274 5763 9425 9961'.credit_card_brand_name
'5274 5763 9425 9961'.valid_credit_card_brand?(:mastercard, :visa)
'5274 5763 9425 9961'.valid_credit_card_brand?(:amex)

Public Instance Methods

credit_card_brand() click to toggle source
# File lib/credit_card_validations/string.rb, line 10
def credit_card_brand
  CreditCardValidations::Detector.new(self).brand
end
credit_card_brand_name() click to toggle source
# File lib/credit_card_validations/string.rb, line 18
def credit_card_brand_name
  CreditCardValidations::Detector.new(self).brand_name
end
valid_credit_card_brand?(*brands) click to toggle source
# File lib/credit_card_validations/string.rb, line 14
def valid_credit_card_brand?(*brands)
  CreditCardValidations::Detector.new(self).valid?(*brands)
end