Class: HashValidator::Validator::EmailValidator
- Defined in:
- lib/hash_validator/validators/email_validator.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ EmailValidator
constructor
A new instance of EmailValidator.
- #presence_error_message ⇒ Object
- #validate(key, value, _validations, errors) ⇒ Object
Methods inherited from Base
Constructor Details
#initialize ⇒ EmailValidator
Returns a new instance of EmailValidator.
2 3 4 |
# File 'lib/hash_validator/validators/email_validator.rb', line 2 def initialize super('email') # The name of the validator end |
Instance Method Details
#presence_error_message ⇒ Object
6 7 8 |
# File 'lib/hash_validator/validators/email_validator.rb', line 6 def 'is not a valid email' end |
#validate(key, value, _validations, errors) ⇒ Object
10 11 12 13 14 |
# File 'lib/hash_validator/validators/email_validator.rb', line 10 def validate(key, value, _validations, errors) unless value.is_a?(String) && value.include?("@") errors[key] = end end |