Class: MailShield::SecureEmailValidator
- Inherits:
-
ActiveModel::Validator
- Object
- ActiveModel::Validator
- MailShield::SecureEmailValidator
show all
- Defined in:
- lib/mailshield/secure_email_validator.rb
Instance Method Summary
collapse
Instance Method Details
#validate(record) ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/mailshield/secure_email_validator.rb', line 7
def validate(record)
email = record.email
return if email.blank?
result = MailShield.validate_email(email)
return if result[:valid]
record.errors.add(:base, result[:reason])
end
|