Sha256: eadfbe43d9e727dcbf8017a1e9539e023054f0c26d3e03e1e8f527700cfb0758
Contents?: true
Size: 455 Bytes
Versions: 13
Compression:
Stored size: 455 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
13 entries across 13 versions & 1 rubygems