Sha256: abdcde4c36ba1e72d44935b91bc91ac76585f4ec9db9d43abc3f69d67da9467e
Contents?: true
Size: 457 Bytes
Versions: 3
Compression:
Stored size: 457 Bytes
Contents
class HashValidator::Validator::EmailValidator < HashValidator::Validator::Base def initialize super('email') # The name of the validator end def presence_error_message 'is not a valid email' end def validate(key, value, _validations, errors) unless value.is_a?(String) && value.include?("@") errors[key] = presence_error_message end end end HashValidator.append_validator(HashValidator::Validator::EmailValidator.new)
Version data entries
3 entries across 3 versions & 1 rubygems