Class: UffizziCore::EmailValidator
- Inherits:
-
ActiveModel::EachValidator
- Object
- ActiveModel::EachValidator
- UffizziCore::EmailValidator
- Defined in:
- app/validators/uffizzi_core/email_validator.rb
Constant Summary collapse
- EMAIL_REGEXP =
/\A([^@\s<>]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i.freeze
Instance Method Summary collapse
Instance Method Details
#validate_each(record, attribute, value) ⇒ Object
6 7 8 |
# File 'app/validators/uffizzi_core/email_validator.rb', line 6 def validate_each(record, attribute, value) record.errors.add(attribute, ([:message] || :invalid)) unless value&.match?(EMAIL_REGEXP) end |