Module: CardValidator::Validator

Defined in:
lib/card_validator/validator.rb,
lib/card_validator/validator/luhn_alg.rb,
lib/card_validator/validator/type_validator.rb

Defined Under Namespace

Modules: LuhnAlg, TypeValidator

Class Method Summary collapse

Class Method Details

.valid?(card) ⇒ Boolean

Returns:

  • (Boolean)

5
6
7
8
9
10
# File 'lib/card_validator/validator.rb', line 5

def valid?(card)
  card = card.gsub(' ', '')
  number?(card) &&
    TypeValidator.valid?(card) &&
      LuhnAlg.valid?(card)
end