Sha256: bf4b74635f7497d8ba0f07b470cf80332f04df06681b22f1afcbeae39ccabb37
Contents?: true
Size: 479 Bytes
Versions: 9
Compression:
Stored size: 479 Bytes
Contents
# frozen_string_literal: true require "pakyow/validator" module Pakyow module Validations # Validates that the value is a valid email address. # # @api public module Email REGEX = /\A[A-Z0-9._%+-]+@(?:[A-Z0-9-]+\.)+[A-Z]{2,4}\z/i def self.message(**) "must be a valid email address" end def self.valid?(value, **) value.to_s.match?(REGEX) end end Validator.register_validation(Email, :email) end end
Version data entries
9 entries across 9 versions & 1 rubygems