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



72
73
74
75
76
77
78
79
80
# File 'lib/cbraspag/payment/eft.rb', line 72

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