6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
|
# File 'lib/email_check/email_validator.rb', line 6
def validate_each(record, attribute, value)
error(record, attribute) unless value.present?
address = EmailCheck::EmailAddress.new(value)
error(record, attribute) && return unless address.format_valid?
return if address.whitelisted?
if options[:disposable]
error(record, attribute) && return if address.disposable?
end
if options[:blacklist]
error(record, attribute) && return if address.blacklisted?
end
if options[:free]
error(record, attribute) && return if address.free?
end
if options[:mx]
error(record, attribute) && return unless address.domain_has_mx?
end
end
|