Sha256: 7067b4933b51f02cc746d148879dc2da4a9369f6937658c807308ccfdcde21b2
Contents?: true
Size: 369 Bytes
Versions: 10
Compression:
Stored size: 369 Bytes
Contents
# frozen_string_literal: true class EmailValidator < BaseValidator REGEXP = /\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\z/i private def valid_attr? valid_regexp? && valid_domain? end def valid_domain? return true unless options.key?(:domain) Array(options[:domain]).any? { |domain| value.downcase.end_with?(".#{domain.downcase}") } end end
Version data entries
10 entries across 10 versions & 1 rubygems