email_inquire 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- lib = File.expand_path("../lib", __FILE__)
3
+ lib = File.expand_path("lib", __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require "email_inquire/version"
6
6
 
@@ -27,8 +27,8 @@ Gem::Specification.new do |spec|
27
27
 
28
28
  spec.add_runtime_dependency("damerau-levenshtein", "~> 1.2")
29
29
 
30
- spec.add_development_dependency("bundler", "~> 1.15")
30
+ spec.add_development_dependency("bundler", "~> 2.0")
31
31
  spec.add_development_dependency("rake", "~> 10.0")
32
- spec.add_development_dependency("rspec", "~> 3.7.0")
33
- spec.add_development_dependency("rubocop", "0.52.0")
32
+ spec.add_development_dependency("rspec", "~> 3.8.0")
33
+ spec.add_development_dependency("rubocop", "0.62.0")
34
34
  end
@@ -32,4 +32,24 @@ module EmailInquire
32
32
  @@custom_invalid_domains
33
33
  end
34
34
 
35
+ def self.custom_valid_domains=(domains)
36
+ @@custom_valid_domains =
37
+ case domains
38
+ when Set
39
+ domains
40
+ when Array
41
+ domains.to_set
42
+ when nil
43
+ Set.new
44
+ else
45
+ raise ArgumentError, "Unsupported type in `custom_valid_domains=`"
46
+ end
47
+ end
48
+
49
+ def self.custom_valid_domains
50
+ @@custom_valid_domains ||= Set.new
51
+
52
+ @@custom_valid_domains
53
+ end
54
+
35
55
  end
@@ -15,6 +15,7 @@ module EmailInquire
15
15
  def valid?
16
16
  return false unless email.count("@") == 1
17
17
  return false if email.length > 255
18
+
18
19
  name, domain = email.split("@", 2)
19
20
 
20
21
  name_valid?(name) && domain_valid?(domain)
@@ -38,7 +39,7 @@ module EmailInquire
38
39
  ){1,8}
39
40
  [a-z]{2,63}
40
41
  \z
41
- /x
42
+ /x.freeze
42
43
 
43
44
  def domain_valid?(domain)
44
45
  return false if domain == ""
@@ -52,7 +53,7 @@ module EmailInquire
52
53
  [a-z0-9]
53
54
  [a-z0-9._%+-]{0,63}
54
55
  \z
55
- /x
56
+ /x.freeze
56
57
 
57
58
  def name_valid?(name)
58
59
  return false if name == ""
@@ -29,6 +29,7 @@ module EmailInquire
29
29
  attr_reader :domain, :email, :name
30
30
 
31
31
  VALIDATORS = %i[
32
+ validate_custom_valid_domains
32
33
  validate_common_domains
33
34
  validate_one_time_providers
34
35
  validate_known_invalid_domains
@@ -173,5 +174,9 @@ module EmailInquire
173
174
  response.invalid! if EmailInquire.custom_invalid_domains.include?(domain)
174
175
  end
175
176
 
177
+ def validate_custom_valid_domains
178
+ response.valid! if EmailInquire.custom_valid_domains.include?(domain)
179
+ end
180
+
176
181
  end
177
182
  end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module EmailInquire
4
4
 
5
- VERSION = "0.8.0"
5
+ VERSION = "0.9.0"
6
6
 
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_inquire
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Garcia
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-12-26 00:00:00.000000000 Z
11
+ date: 2019-01-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: damerau-levenshtein
@@ -30,14 +30,14 @@ dependencies:
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.15'
33
+ version: '2.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: '1.15'
40
+ version: '2.0'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
@@ -58,28 +58,28 @@ dependencies:
58
58
  requirements:
59
59
  - - "~>"
60
60
  - !ruby/object:Gem::Version
61
- version: 3.7.0
61
+ version: 3.8.0
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
66
  - - "~>"
67
67
  - !ruby/object:Gem::Version
68
- version: 3.7.0
68
+ version: 3.8.0
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: 0.52.0
75
+ version: 0.62.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
80
  - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: 0.52.0
82
+ version: 0.62.0
83
83
  description: Library to validate email for format, common typos and one-time email
84
84
  providers
85
85
  email:
@@ -135,8 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
135
135
  - !ruby/object:Gem::Version
136
136
  version: '0'
137
137
  requirements: []
138
- rubyforge_project:
139
- rubygems_version: 2.7.4
138
+ rubygems_version: 3.0.2
140
139
  signing_key:
141
140
  specification_version: 4
142
141
  summary: Library to validate email for format, common typos and one-time email providers