Class: EnvValidator::Types::Email
- Defined in:
- lib/env_validator/types.rb
Constant Summary collapse
- EMAIL_REGEX =
Basic email regex - not RFC compliant but good enough for most cases
/\A[^@\s]+@[^@\s]+\.[^@\s]+\z/
Instance Method Summary collapse
Methods inherited from Base
Instance Method Details
#validate(value) ⇒ Object
99 100 101 102 103 |
# File 'lib/env_validator/types.rb', line 99 def validate(value) raise TypeError, "Expected valid email address, got #{value.inspect}" unless value.to_s.match?(EMAIL_REGEX) true end |