Class: String
- Inherits:
-
Object
- Object
- String
- Defined in:
- lib/credit_card_validations/string.rb
Overview
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)
Instance Method Summary collapse
- #credit_card_brand ⇒ Object
- #credit_card_brand_name ⇒ Object
- #valid_credit_card_brand?(*brands) ⇒ Boolean
Instance Method Details
#credit_card_brand ⇒ Object
10 11 12 |
# File 'lib/credit_card_validations/string.rb', line 10 def credit_card_brand CreditCardValidations::Detector.new(self).brand end |
#credit_card_brand_name ⇒ Object
18 19 20 |
# 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) ⇒ Boolean
14 15 16 |
# File 'lib/credit_card_validations/string.rb', line 14 def valid_credit_card_brand?(*brands) CreditCardValidations::Detector.new(self).valid?(*brands) end |