Class: Braspag::EFT::CryptoValidator

Inherits:
ActiveModel::EachValidator
  • Object
show all
Defined in:
lib/cbraspag/payment/eft.rb

Instance Method Summary collapse

Instance Method Details

#validate_each(record, attribute, value) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/cbraspag/payment/eft.rb', line 56

def validate_each(record, attribute, value)
  unless (
    value.kind_of?(Braspag::Crypto::Webservice) ||
    value.kind_of?(Braspag::Crypto::NoCrypto) ||
    value.kind_of?(Braspag::Crypto::JarWebservice)
  )
    record.errors.add attribute, "invalid crypto"
  end
end