freemail 0.2.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.codeclimate.yml +11 -0
- data/.rubocop.yml +6 -0
- data/.travis.yml +15 -2
- data/README.md +23 -2
- data/data/disposable.txt +58 -20
- data/data/free.txt +4393 -0
- data/freemail.gemspec +2 -2
- data/lib/freemail.rb +12 -2
- data/lib/freemail/version.rb +1 -1
- metadata +16 -15
data/freemail.gemspec
CHANGED
@@ -22,7 +22,7 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ['lib']
|
24
24
|
|
25
|
-
spec.add_development_dependency '
|
26
|
-
spec.add_development_dependency 'rake', '~> 10.0'
|
25
|
+
spec.add_development_dependency 'rake'
|
27
26
|
spec.add_development_dependency 'rspec'
|
27
|
+
spec.add_development_dependency 'simplecov'
|
28
28
|
end
|
data/lib/freemail.rb
CHANGED
@@ -5,6 +5,16 @@ module Freemail
|
|
5
5
|
DISPOSABLE = Hash[File.readlines("#{ROOT}/data/disposable.txt").map { |d| [d.strip.downcase] }]
|
6
6
|
FREE = Hash[File.readlines("#{ROOT}/data/free.txt").map { |d| [d.strip.downcase] }]
|
7
7
|
|
8
|
+
def self.add_disposable_domains(custom_domains)
|
9
|
+
custom_domains = [custom_domains] unless custom_domains.is_a? Array
|
10
|
+
custom_domains.each { |domain| DISPOSABLE[domain] = nil }
|
11
|
+
end
|
12
|
+
|
13
|
+
def self.add_free_domains(custom_domains)
|
14
|
+
custom_domains = [custom_domains] unless custom_domains.is_a? Array
|
15
|
+
custom_domains.each { |domain| FREE[domain] = nil }
|
16
|
+
end
|
17
|
+
|
8
18
|
def self.free?(email)
|
9
19
|
FREE.key?(get_domain(email))
|
10
20
|
end
|
@@ -14,9 +24,9 @@ module Freemail
|
|
14
24
|
end
|
15
25
|
|
16
26
|
def self.free_or_disposable?(email)
|
17
|
-
free?(email) || disposable?(email)
|
27
|
+
free?(email) || disposable?(email)
|
18
28
|
end
|
19
|
-
|
29
|
+
|
20
30
|
def self.get_domain(email)
|
21
31
|
email.split('@').last.downcase.strip
|
22
32
|
end
|
data/lib/freemail/version.rb
CHANGED
metadata
CHANGED
@@ -1,45 +1,45 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: freemail
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- smudge
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: rake
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '0'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: simplecov
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -61,8 +61,10 @@ executables: []
|
|
61
61
|
extensions: []
|
62
62
|
extra_rdoc_files: []
|
63
63
|
files:
|
64
|
+
- ".codeclimate.yml"
|
64
65
|
- ".gitignore"
|
65
66
|
- ".rspec"
|
67
|
+
- ".rubocop.yml"
|
66
68
|
- ".travis.yml"
|
67
69
|
- Gemfile
|
68
70
|
- LICENSE.txt
|
@@ -94,8 +96,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
94
96
|
- !ruby/object:Gem::Version
|
95
97
|
version: '0'
|
96
98
|
requirements: []
|
97
|
-
|
98
|
-
rubygems_version: 2.4.5.1
|
99
|
+
rubygems_version: 3.1.2
|
99
100
|
signing_key:
|
100
101
|
specification_version: 4
|
101
102
|
summary: '["A", "ruby", "implementation", "of", "the", "npm", "''freemail''", "module"]'
|