email_repair 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/email_repair/mechanic.rb +5 -2
- data/lib/email_repair/version.rb +1 -1
- data/lib/email_repair.rb +1 -0
- data/spec/lib/email_repair/mechanic_spec.rb +9 -0
- metadata +3 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 105137fd47de14a0ff9abb61245e332307302acddb760a537e6ab284a042ca1b
|
4
|
+
data.tar.gz: e5286f3eb0a792a1c3492eff0b29eb65b0456979fd2e7066cecab6de37b1ca0e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cdb2c7e2e99c6141050d3081b3ca7cd1864b9f81fc1f51616de271e5bd669295d8937e183899541179cf5766edc5f573cb8a84ca585bc864dbf6c6060197b977
|
7
|
+
data.tar.gz: 400e9eae791a4c1a1271f3472f28a4d3c7e5f7144530f9b66df786910db241d1e94bf6807b43ce0ac2da6b6b072f1f1fde78161cd54c889c933c6f84927074f0
|
@@ -96,8 +96,11 @@ module EmailRepair
|
|
96
96
|
|
97
97
|
class CommonDomainAtAdder < CommonDomainRepair
|
98
98
|
def self.repair(email)
|
99
|
+
return email if email.match('.+@.+\..+')
|
100
|
+
|
99
101
|
common_domains.each do |name, suffix|
|
100
102
|
punc_regex = /[.#-]#{name}.#{suffix}$/
|
103
|
+
|
101
104
|
if email.match(punc_regex)
|
102
105
|
email = email.sub(punc_regex, "@#{name}.#{suffix}")
|
103
106
|
elsif email.match?(/[^@]#{name}.#{suffix}$/)
|
@@ -112,8 +115,8 @@ module EmailRepair
|
|
112
115
|
def self.repair(email)
|
113
116
|
swapped_names.each do |swapped, real|
|
114
117
|
suffix = common_domains[real]
|
115
|
-
regex =
|
116
|
-
email = email.sub(regex, "
|
118
|
+
regex = /@#{swapped}.#{suffix}$/
|
119
|
+
email = email.sub(regex, "@#{real}.#{suffix}") if email.match(regex)
|
117
120
|
end
|
118
121
|
email
|
119
122
|
end
|
data/lib/email_repair/version.rb
CHANGED
data/lib/email_repair.rb
CHANGED
@@ -109,6 +109,11 @@ module EmailRepair
|
|
109
109
|
end
|
110
110
|
end
|
111
111
|
|
112
|
+
it 'does not sanitize when common domain is part of the domain' do
|
113
|
+
email = 'me@goal.com'
|
114
|
+
expect(mechanic.repair(email)).to eq email
|
115
|
+
end
|
116
|
+
|
112
117
|
it 'swaps a # for an @ for common domains' do
|
113
118
|
expect(mechanic.repair('pound#yahoo.com')).to eq 'pound@yahoo.com'
|
114
119
|
end
|
@@ -123,6 +128,10 @@ module EmailRepair
|
|
123
128
|
end
|
124
129
|
end
|
125
130
|
|
131
|
+
it 'does not add an extra @ if there is already one' do
|
132
|
+
expect(mechanic.repair('bloo@myyahoo.com')).to eq 'bloo@myyahoo.com'
|
133
|
+
end
|
134
|
+
|
126
135
|
it 'replaces , with .' do
|
127
136
|
expect(mechanic.repair('b@b,com')).to eq 'b@b.com'
|
128
137
|
end
|
metadata
CHANGED
@@ -1,15 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_repair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.0.
|
4
|
+
version: 2.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Holman Gao
|
8
8
|
- JT Bowler
|
9
|
-
autorequire:
|
10
9
|
bindir: bin
|
11
10
|
cert_chain: []
|
12
|
-
date:
|
11
|
+
date: 1980-01-02 00:00:00.000000000 Z
|
13
12
|
dependencies:
|
14
13
|
- !ruby/object:Gem::Dependency
|
15
14
|
name: coveralls
|
@@ -67,7 +66,6 @@ dependencies:
|
|
67
66
|
- - "~>"
|
68
67
|
- !ruby/object:Gem::Version
|
69
68
|
version: 1.50.2
|
70
|
-
description:
|
71
69
|
email:
|
72
70
|
- holman@golmansax.com
|
73
71
|
- jbowler2400@gmail.com
|
@@ -88,7 +86,6 @@ homepage: https://github.com/ChalkSchools/email-repair
|
|
88
86
|
licenses:
|
89
87
|
- MIT
|
90
88
|
metadata: {}
|
91
|
-
post_install_message:
|
92
89
|
rdoc_options: []
|
93
90
|
require_paths:
|
94
91
|
- lib
|
@@ -103,8 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
103
100
|
- !ruby/object:Gem::Version
|
104
101
|
version: '0'
|
105
102
|
requirements: []
|
106
|
-
rubygems_version: 3.
|
107
|
-
signing_key:
|
103
|
+
rubygems_version: 3.6.9
|
108
104
|
specification_version: 4
|
109
105
|
summary: Library to fix invalid emails
|
110
106
|
test_files:
|