email_assessor 0.8.3 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/data/blacklisted_domains/_prioritization.txt +1 -0
- data/assets/data/disposable_domains/0.txt +723 -0
- data/assets/data/disposable_domains/1.txt +1500 -0
- data/assets/data/disposable_domains/2.txt +1267 -0
- data/assets/data/disposable_domains/3.txt +1078 -0
- data/assets/data/disposable_domains/4.txt +854 -0
- data/assets/data/disposable_domains/5.txt +793 -0
- data/assets/data/disposable_domains/6.txt +900 -0
- data/assets/data/disposable_domains/7.txt +787 -0
- data/assets/data/disposable_domains/8.txt +979 -0
- data/assets/data/disposable_domains/9.txt +843 -0
- data/assets/data/disposable_domains/_prioritization.txt +1 -0
- data/assets/data/disposable_domains/a.txt +10167 -0
- data/assets/data/disposable_domains/b.txt +10443 -0
- data/assets/data/disposable_domains/c.txt +10152 -0
- data/assets/data/disposable_domains/d.txt +7619 -0
- data/assets/data/disposable_domains/e.txt +5689 -0
- data/assets/data/disposable_domains/f.txt +6375 -0
- data/assets/data/disposable_domains/g.txt +6309 -0
- data/assets/data/disposable_domains/h.txt +6204 -0
- data/assets/data/disposable_domains/i.txt +4814 -0
- data/assets/data/disposable_domains/j.txt +3163 -0
- data/assets/data/disposable_domains/k.txt +4308 -0
- data/assets/data/disposable_domains/l.txt +5903 -0
- data/assets/data/disposable_domains/m.txt +11177 -0
- data/assets/data/disposable_domains/n.txt +4895 -0
- data/assets/data/disposable_domains/o.txt +4161 -0
- data/assets/data/disposable_domains/p.txt +8264 -0
- data/assets/data/disposable_domains/q.txt +1493 -0
- data/assets/data/disposable_domains/r.txt +6199 -0
- data/assets/data/disposable_domains/s.txt +12775 -0
- data/assets/data/disposable_domains/t.txt +9496 -0
- data/assets/data/disposable_domains/u.txt +2662 -0
- data/assets/data/disposable_domains/v.txt +3766 -0
- data/assets/data/disposable_domains/w.txt +4633 -0
- data/assets/data/disposable_domains/x.txt +2449 -0
- data/assets/data/disposable_domains/y.txt +2278 -0
- data/assets/data/disposable_domains/z.txt +2035 -0
- data/assets/data/disposable_domains//351/231/270.txt +1 -0
- data/assets/data/disposable_domains//353/234/203.txt +1 -0
- data/assets/data/educational_domains/5.txt +1 -0
- data/assets/data/educational_domains/_prioritization.txt +1 -0
- data/assets/data/educational_domains/a.txt +232 -0
- data/assets/data/educational_domains/b.txt +112 -0
- data/assets/data/educational_domains/c.txt +126 -0
- data/assets/data/educational_domains/d.txt +90 -0
- data/assets/data/educational_domains/e.txt +331 -0
- data/assets/data/educational_domains/f.txt +156 -0
- data/assets/data/educational_domains/g.txt +75 -0
- data/assets/data/educational_domains/h.txt +147 -0
- data/assets/data/educational_domains/i.txt +179 -0
- data/assets/data/educational_domains/j.txt +26 -0
- data/assets/data/educational_domains/k.txt +142 -0
- data/assets/data/educational_domains/l.txt +88 -0
- data/assets/data/educational_domains/m.txt +155 -0
- data/assets/data/educational_domains/n.txt +98 -0
- data/assets/data/educational_domains/o.txt +39 -0
- data/assets/data/educational_domains/p.txt +128 -0
- data/assets/data/educational_domains/q.txt +4 -0
- data/assets/data/educational_domains/r.txt +69 -0
- data/assets/data/educational_domains/s.txt +251 -0
- data/assets/data/educational_domains/t.txt +146 -0
- data/assets/data/educational_domains/u.txt +975 -0
- data/assets/data/educational_domains/v.txt +78 -0
- data/assets/data/educational_domains/w.txt +59 -0
- data/assets/data/educational_domains/x.txt +1 -0
- data/assets/data/educational_domains/y.txt +17 -0
- data/assets/data/educational_domains/z.txt +13 -0
- data/assets/data/fastpass_domains/_prioritization.txt +1 -0
- data/assets/data/fastpass_domains/a.txt +2 -0
- data/assets/data/fastpass_domains/c.txt +3 -0
- data/assets/data/fastpass_domains/d.txt +1 -0
- data/assets/data/fastpass_domains/f.txt +1 -0
- data/assets/data/fastpass_domains/g.txt +5 -0
- data/assets/data/fastpass_domains/h.txt +33 -0
- data/assets/data/fastpass_domains/i.txt +1 -0
- data/assets/data/fastpass_domains/l.txt +6 -0
- data/assets/data/fastpass_domains/m.txt +4 -0
- data/assets/data/fastpass_domains/o.txt +28 -0
- data/assets/data/fastpass_domains/p.txt +3 -0
- data/assets/data/fastpass_domains/r.txt +1 -0
- data/assets/data/fastpass_domains/s.txt +3 -0
- data/assets/data/fastpass_domains/t.txt +1 -0
- data/assets/data/fastpass_domains/w.txt +2 -0
- data/assets/data/fastpass_domains/y.txt +42 -0
- data/lib/email_assessor/address.rb +27 -26
- data/lib/email_assessor/directory_domain_list.rb +51 -0
- data/lib/email_assessor/domain_token_set.rb +46 -0
- data/lib/email_assessor/email_validator.rb +0 -16
- data/lib/email_assessor/empty_domain_list.rb +23 -0
- data/lib/email_assessor/file_domain_list.rb +23 -0
- data/lib/email_assessor/version.rb +1 -1
- data/lib/email_assessor.rb +64 -17
- metadata +94 -22
- data/.gitignore +0 -18
- data/.travis.yml +0 -9
- data/CHANGELOG.md +0 -9
- data/Gemfile +0 -4
- data/LICENSE.txt +0 -22
- data/README.md +0 -132
- data/Rakefile +0 -10
- data/email_assessor.gemspec +0 -31
- data/gemfiles/activemodel4.gemfile +0 -5
- data/pull_mailchecker_emails.rb +0 -21
- data/spec/email_assessor_spec.rb +0 -209
- data/spec/spec_helper.rb +0 -19
- data/vendor/disposable_domains.txt +0 -55800
- data/vendor/educational_domains.txt +0 -3625
- data/vendor/fastpass_domains.txt +0 -35
- /data/{vendor/blacklisted_domains.txt → assets/data/blacklisted_domains/b.txt} +0 -0
@@ -0,0 +1,78 @@
|
|
1
|
+
va.lv
|
2
|
+
valahia.ro
|
3
|
+
valleystudent.org
|
4
|
+
vaniercollege.qc.ca
|
5
|
+
vansd.org
|
6
|
+
vbu.co.in
|
7
|
+
vbu.se
|
8
|
+
vcc.ca
|
9
|
+
vdu.lt
|
10
|
+
veda-edu.com
|
11
|
+
venturaedu.org
|
12
|
+
ver.ucc.mx
|
13
|
+
vern.hr
|
14
|
+
vet-alfort.fr
|
15
|
+
vet-lyon.fr
|
16
|
+
vet-nantes.fr
|
17
|
+
veths.no
|
18
|
+
vfrta.ru
|
19
|
+
vfu.bg
|
20
|
+
vfu.cz
|
21
|
+
vgafk.ru
|
22
|
+
vgasa.ru
|
23
|
+
vgmu.vitebsk.by
|
24
|
+
vgta.vrn.ru
|
25
|
+
vgtu.lt
|
26
|
+
victoria-uni.ch
|
27
|
+
victoryedu.com
|
28
|
+
vicu.utoronto.ca
|
29
|
+
vieup.ru
|
30
|
+
vignanuniversity.org
|
31
|
+
vikramuniversity.org
|
32
|
+
vinayakamissions.com
|
33
|
+
vineland.org
|
34
|
+
vkgu.kz
|
35
|
+
vksu-ara.org
|
36
|
+
vlekho.be
|
37
|
+
vlerick.be
|
38
|
+
vlsu.ru
|
39
|
+
vmchs.com
|
40
|
+
vnmu.vn.ua
|
41
|
+
voenmeh.ru
|
42
|
+
volsu.ru
|
43
|
+
vorskoler.com
|
44
|
+
vorskoler.net
|
45
|
+
vpu.lt
|
46
|
+
vsau.ru
|
47
|
+
vsavm.com
|
48
|
+
vsb.cz
|
49
|
+
vscht.cz
|
50
|
+
vsci.cz
|
51
|
+
vse.cz
|
52
|
+
vsgaki.burnet.ru
|
53
|
+
vsgtu.eastsib.ru
|
54
|
+
vslib.cz
|
55
|
+
vsm.sk
|
56
|
+
vsma.info
|
57
|
+
vsmu.sk
|
58
|
+
vsp.cz
|
59
|
+
vspu.kirov.ru
|
60
|
+
vspu.ru
|
61
|
+
vssladkovicovo.sk
|
62
|
+
vssvalzbety.sk
|
63
|
+
vstu.ru
|
64
|
+
vstu.vinnica.ua
|
65
|
+
vstu.vitebsk.by
|
66
|
+
vsu.by
|
67
|
+
vsu.ru
|
68
|
+
vsvu.sk
|
69
|
+
vu.lt
|
70
|
+
vu.nl
|
71
|
+
vub.be
|
72
|
+
vumk.eu
|
73
|
+
vusd.us
|
74
|
+
vut.cz
|
75
|
+
vutbr.cz
|
76
|
+
vvsd.org
|
77
|
+
vvsu.ru
|
78
|
+
vxu.se
|
@@ -0,0 +1,59 @@
|
|
1
|
+
wabash348.com
|
2
|
+
wageningenuniversity.nl
|
3
|
+
waitakerecollege.school.nz
|
4
|
+
wakf.org
|
5
|
+
warrenk12nc.org
|
6
|
+
warrensd.org
|
7
|
+
washk12.org
|
8
|
+
watfordboys.org
|
9
|
+
wbuafs.nic.in
|
10
|
+
wbut.net
|
11
|
+
wcs-g.com
|
12
|
+
wcusd.net
|
13
|
+
wdsdjxy.com
|
14
|
+
web.prover.com.br
|
15
|
+
webs.satlink.com
|
16
|
+
webster.ch
|
17
|
+
wenk.be
|
18
|
+
westburyschools.org
|
19
|
+
westcoastuniversity-edu.com
|
20
|
+
westcoastuniversity.bz
|
21
|
+
westfieldacademy.co.uk
|
22
|
+
westhillscollege.com
|
23
|
+
westmorelandschool.org
|
24
|
+
westorangeschools.org
|
25
|
+
whu-koblenz.de
|
26
|
+
williamgilbert.co.uk
|
27
|
+
willistonschools.org
|
28
|
+
wilsonk12tn.us
|
29
|
+
windesheim.nl
|
30
|
+
wit.ie
|
31
|
+
wittenborg.eu
|
32
|
+
wiut.uz
|
33
|
+
wkau.kz
|
34
|
+
wlodkowic.pl
|
35
|
+
wlu.ca
|
36
|
+
wmsd.net
|
37
|
+
wmu.se
|
38
|
+
worcesterschools.net
|
39
|
+
wpsstudent.com
|
40
|
+
wsb.poznan.pl
|
41
|
+
wsb.toi.tarnow.pl
|
42
|
+
wsdoc.me
|
43
|
+
wsei.lublin.pl
|
44
|
+
wsiz.rzeszow.pl
|
45
|
+
wsm.gdynia.pl
|
46
|
+
wsm.szczecin.pl
|
47
|
+
wsp.bydgoszcz.pl
|
48
|
+
wsp.czest.pl
|
49
|
+
wsp.krakow.pl
|
50
|
+
wsp.slupsk.pl
|
51
|
+
wsp.zgora.pl
|
52
|
+
wsps.waw.pl
|
53
|
+
wsub.waw.pl
|
54
|
+
wsz.pl
|
55
|
+
wszib.krakow.pl
|
56
|
+
wvu.edu
|
57
|
+
wwu.de
|
58
|
+
www2.mozcom.com
|
59
|
+
wzmu.net
|
@@ -0,0 +1 @@
|
|
1
|
+
xza.cn
|
@@ -0,0 +1 @@
|
|
1
|
+
dfirtawcpsmglohy
|
@@ -0,0 +1 @@
|
|
1
|
+
duck.com
|
@@ -0,0 +1 @@
|
|
1
|
+
fastmail.com
|
@@ -0,0 +1,33 @@
|
|
1
|
+
hotmail.be
|
2
|
+
hotmail.ca
|
3
|
+
hotmail.ch
|
4
|
+
hotmail.cl
|
5
|
+
hotmail.co.id
|
6
|
+
hotmail.co.jp
|
7
|
+
hotmail.co.kr
|
8
|
+
hotmail.co.nz
|
9
|
+
hotmail.co.th
|
10
|
+
hotmail.co.uk
|
11
|
+
hotmail.co.za
|
12
|
+
hotmail.com
|
13
|
+
hotmail.com.ar
|
14
|
+
hotmail.com.au
|
15
|
+
hotmail.com.br
|
16
|
+
hotmail.com.tr
|
17
|
+
hotmail.com.tw
|
18
|
+
hotmail.de
|
19
|
+
hotmail.dk
|
20
|
+
hotmail.es
|
21
|
+
hotmail.fi
|
22
|
+
hotmail.fr
|
23
|
+
hotmail.gr
|
24
|
+
hotmail.hu
|
25
|
+
hotmail.it
|
26
|
+
hotmail.my
|
27
|
+
hotmail.nl
|
28
|
+
hotmail.no
|
29
|
+
hotmail.ph
|
30
|
+
hotmail.rs
|
31
|
+
hotmail.se
|
32
|
+
hotmail.sg
|
33
|
+
hotmail.sk
|
@@ -0,0 +1 @@
|
|
1
|
+
icloud.com
|
@@ -0,0 +1,28 @@
|
|
1
|
+
o2.pl
|
2
|
+
orange.fr
|
3
|
+
outlook.at
|
4
|
+
outlook.be
|
5
|
+
outlook.co.id
|
6
|
+
outlook.co.nz
|
7
|
+
outlook.co.th
|
8
|
+
outlook.com
|
9
|
+
outlook.com.ar
|
10
|
+
outlook.com.au
|
11
|
+
outlook.com.br
|
12
|
+
outlook.com.tr
|
13
|
+
outlook.com.vn
|
14
|
+
outlook.cz
|
15
|
+
outlook.de
|
16
|
+
outlook.dk
|
17
|
+
outlook.es
|
18
|
+
outlook.fr
|
19
|
+
outlook.hu
|
20
|
+
outlook.in
|
21
|
+
outlook.it
|
22
|
+
outlook.jp
|
23
|
+
outlook.kr
|
24
|
+
outlook.ph
|
25
|
+
outlook.pt
|
26
|
+
outlook.sa
|
27
|
+
outlook.sg
|
28
|
+
outlook.sk
|
@@ -0,0 +1 @@
|
|
1
|
+
rocketmail.com
|
@@ -0,0 +1 @@
|
|
1
|
+
tuta.io
|
@@ -0,0 +1,42 @@
|
|
1
|
+
yahoo.at
|
2
|
+
yahoo.be
|
3
|
+
yahoo.ca
|
4
|
+
yahoo.cl
|
5
|
+
yahoo.co.id
|
6
|
+
yahoo.co.in
|
7
|
+
yahoo.co.jp
|
8
|
+
yahoo.co.nz
|
9
|
+
yahoo.co.th
|
10
|
+
yahoo.co.uk
|
11
|
+
yahoo.co.za
|
12
|
+
yahoo.com
|
13
|
+
yahoo.com.ar
|
14
|
+
yahoo.com.au
|
15
|
+
yahoo.com.br
|
16
|
+
yahoo.com.co
|
17
|
+
yahoo.com.hk
|
18
|
+
yahoo.com.hr
|
19
|
+
yahoo.com.mx
|
20
|
+
yahoo.com.my
|
21
|
+
yahoo.com.ph
|
22
|
+
yahoo.com.sg
|
23
|
+
yahoo.com.tw
|
24
|
+
yahoo.com.ve
|
25
|
+
yahoo.com.vn
|
26
|
+
yahoo.de
|
27
|
+
yahoo.dk
|
28
|
+
yahoo.es
|
29
|
+
yahoo.fr
|
30
|
+
yahoo.gr
|
31
|
+
yahoo.hu
|
32
|
+
yahoo.ie
|
33
|
+
yahoo.in
|
34
|
+
yahoo.it
|
35
|
+
yahoo.ne.jp
|
36
|
+
yahoo.nl
|
37
|
+
yahoo.no
|
38
|
+
yahoo.pl
|
39
|
+
yahoo.ro
|
40
|
+
yahoo.se
|
41
|
+
yandex.com
|
42
|
+
ymail.com
|
@@ -5,7 +5,7 @@ require "mail"
|
|
5
5
|
|
6
6
|
module EmailAssessor
|
7
7
|
class Address
|
8
|
-
attr_accessor :
|
8
|
+
attr_accessor :parsed
|
9
9
|
|
10
10
|
PROHIBITED_DOMAIN_PREFIXES = [
|
11
11
|
'.',
|
@@ -83,12 +83,16 @@ module EmailAssessor
|
|
83
83
|
end
|
84
84
|
end
|
85
85
|
|
86
|
-
def initialize(
|
86
|
+
def initialize(raw_address)
|
87
87
|
@parse_error = false
|
88
|
-
@raw_address =
|
88
|
+
@raw_address = raw_address
|
89
|
+
@address = nil
|
90
|
+
@valid = nil
|
91
|
+
@mx_servers = nil
|
92
|
+
@domain_tokens = nil
|
89
93
|
|
90
94
|
begin
|
91
|
-
@address = Mail::Address.new(
|
95
|
+
@address = Mail::Address.new(raw_address)
|
92
96
|
rescue Mail::Field::ParseError
|
93
97
|
@parse_error = true
|
94
98
|
end
|
@@ -99,56 +103,53 @@ module EmailAssessor
|
|
99
103
|
return false if @parse_error
|
100
104
|
|
101
105
|
@valid =
|
102
|
-
if address.domain && address.address == @raw_address
|
103
|
-
domain = address.domain
|
106
|
+
if @address.domain && @address.address == @raw_address
|
107
|
+
domain = @address.domain
|
104
108
|
|
105
109
|
domain.include?('.') &&
|
106
110
|
!domain.match?(self.class.prohibited_domain_regex) &&
|
107
|
-
|
111
|
+
!@address.local.match?(self.class.prohibited_local_regex)
|
108
112
|
else
|
109
113
|
false
|
110
114
|
end
|
111
115
|
end
|
112
116
|
|
113
117
|
def disposable?
|
114
|
-
|
118
|
+
domain_in_list?(EmailAssessor.disposable_domains)
|
115
119
|
end
|
116
120
|
|
117
121
|
def blacklisted?
|
118
|
-
|
122
|
+
domain_in_list?(EmailAssessor.blacklisted_domains)
|
119
123
|
end
|
120
124
|
|
121
125
|
def educational?
|
122
|
-
|
126
|
+
domain_in_list?(EmailAssessor.educational_domains)
|
123
127
|
end
|
124
128
|
|
125
129
|
def fastpass?
|
126
|
-
|
127
|
-
end
|
128
|
-
|
129
|
-
def domain_in_file?(filename)
|
130
|
-
valid? && EmailAssessor.domain_in_file?(address.domain, filename)
|
130
|
+
domain_in_list?(EmailAssessor.fastpass_domains)
|
131
131
|
end
|
132
132
|
|
133
133
|
def valid_mx?
|
134
134
|
valid? && mx_servers.any?
|
135
135
|
end
|
136
136
|
|
137
|
-
def mx_server_is_in?(domain_list_file)
|
138
|
-
mx_servers.any? do |mx_server|
|
139
|
-
return false unless mx_server.respond_to?(:exchange)
|
140
|
-
mx_server = mx_server.exchange.to_s
|
141
|
-
|
142
|
-
EmailAssessor.domain_in_file?(mx_server, domain_list_file)
|
143
|
-
end
|
144
|
-
end
|
145
|
-
|
146
137
|
def mx_servers
|
147
138
|
@mx_servers ||= Resolv::DNS.open do |dns|
|
148
|
-
mx_servers = dns.getresources(address.domain, Resolv::DNS::Resource::IN::MX)
|
139
|
+
mx_servers = dns.getresources(@address.domain, Resolv::DNS::Resource::IN::MX)
|
149
140
|
(mx_servers.any? && mx_servers) ||
|
150
|
-
dns.getresources(address.domain, Resolv::DNS::Resource::IN::A)
|
141
|
+
dns.getresources(@address.domain, Resolv::DNS::Resource::IN::A)
|
151
142
|
end
|
152
143
|
end
|
144
|
+
|
145
|
+
private
|
146
|
+
|
147
|
+
def domain_in_list?(list)
|
148
|
+
valid? && list.include_any?(domain_tokens)
|
149
|
+
end
|
150
|
+
|
151
|
+
def domain_tokens
|
152
|
+
@domain_tokens ||= EmailAssessor.tokenize_domain(@address.domain)
|
153
|
+
end
|
153
154
|
end
|
154
155
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EmailAssessor
|
4
|
+
class DirectoryDomainList
|
5
|
+
attr_reader :pathname
|
6
|
+
|
7
|
+
def include_any?(domain_token_set)
|
8
|
+
chars = if @prioritization.present?
|
9
|
+
@prioritization
|
10
|
+
else
|
11
|
+
domain_token_set.indexes
|
12
|
+
end
|
13
|
+
|
14
|
+
chars.any? { |char| domain_list(char).include_any?(domain_token_set) }
|
15
|
+
end
|
16
|
+
|
17
|
+
def sample
|
18
|
+
File.open(Dir.glob(File.join(@pathname, "?.txt")).first, &:readline).chomp
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def initialize(pathname)
|
24
|
+
prioritization_file_name = File.join(pathname, "_prioritization.txt")
|
25
|
+
|
26
|
+
@prioritization = File.read(prioritization_file_name).split("").freeze if File.exist?(prioritization_file_name)
|
27
|
+
@pathname = pathname
|
28
|
+
@file_map = {
|
29
|
+
# {first_char} => FileDomainList | nil
|
30
|
+
}
|
31
|
+
end
|
32
|
+
|
33
|
+
def domain_list(char)
|
34
|
+
cached = @file_map[char]
|
35
|
+
|
36
|
+
return cached unless cached.nil?
|
37
|
+
|
38
|
+
file_name = File.join(@pathname, "#{char}.txt")
|
39
|
+
|
40
|
+
domain_list = if File.file?(file_name)
|
41
|
+
FileDomainList.new(file_name)
|
42
|
+
else
|
43
|
+
EmptyDomainList.instance
|
44
|
+
end
|
45
|
+
|
46
|
+
@file_map[char] = domain_list
|
47
|
+
|
48
|
+
domain_list
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EmailAssessor
|
4
|
+
class DomainTokenSet
|
5
|
+
class << self
|
6
|
+
def parse(domain)
|
7
|
+
parts = domain.downcase.split(".")
|
8
|
+
indexed_tokens = {
|
9
|
+
# {first_char} => { {segment} => nil }
|
10
|
+
}
|
11
|
+
|
12
|
+
parts.length.times do
|
13
|
+
segment = parts.join(".").freeze
|
14
|
+
|
15
|
+
(indexed_tokens[segment.chr] ||= Hash.new)[segment] = nil
|
16
|
+
|
17
|
+
parts.shift
|
18
|
+
end
|
19
|
+
|
20
|
+
indexed_tokens.each_value(&:freeze)
|
21
|
+
indexed_tokens.freeze
|
22
|
+
|
23
|
+
new(indexed_tokens)
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def include?(domain)
|
28
|
+
tokens_of_char = @indexed_tokens[domain.chr]
|
29
|
+
|
30
|
+
return false if tokens_of_char.nil?
|
31
|
+
|
32
|
+
tokens_of_char.key?(domain)
|
33
|
+
end
|
34
|
+
|
35
|
+
def indexes
|
36
|
+
@indexes ||= @indexed_tokens.keys
|
37
|
+
end
|
38
|
+
|
39
|
+
private
|
40
|
+
|
41
|
+
def initialize(indexed_tokens)
|
42
|
+
@indexed_tokens = indexed_tokens
|
43
|
+
@indexes = nil # Shape friendliness
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
@@ -58,21 +58,5 @@ class EmailValidator < ActiveModel::EachValidator
|
|
58
58
|
if options[:educational]
|
59
59
|
error(record, attribute, error_type(:educational, options)) && return if address.educational?
|
60
60
|
end
|
61
|
-
|
62
|
-
# if options[:domain_not_in]
|
63
|
-
# matched_blocklist = options[:domain_not_in].select do |entry|
|
64
|
-
# unless entry.key?(:blocklist)
|
65
|
-
# fail "domain_not_in entries must be in format { blocklist: \"filename\"[, message: symbol|string] }"
|
66
|
-
# end
|
67
|
-
|
68
|
-
# next unless address.domain_in_blocklist?(entry[:blocklist])
|
69
|
-
|
70
|
-
# error(record, attribute, entry[:message])
|
71
|
-
|
72
|
-
# true
|
73
|
-
# end
|
74
|
-
|
75
|
-
# return if matched_blocklist
|
76
|
-
# end
|
77
61
|
end
|
78
62
|
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EmailAssessor
|
4
|
+
class EmptyDomainList
|
5
|
+
class << self
|
6
|
+
def instance
|
7
|
+
@instance ||= new
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
def include_any?(*)
|
12
|
+
false
|
13
|
+
end
|
14
|
+
|
15
|
+
def sample
|
16
|
+
nil
|
17
|
+
end
|
18
|
+
|
19
|
+
def pathname
|
20
|
+
nil
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module EmailAssessor
|
4
|
+
class FileDomainList
|
5
|
+
attr_reader :pathname
|
6
|
+
|
7
|
+
def include_any?(domain_token_set)
|
8
|
+
File.foreach(@pathname, chomp: true).any? do |domain|
|
9
|
+
domain_token_set.include?(domain)
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def sample
|
14
|
+
File.open(@pathname, &:readline).chomp
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
19
|
+
def initialize(pathname)
|
20
|
+
@pathname = pathname
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|