email_repair 0.0.1 → 0.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/README.md +2 -0
- data/lib/email_repair/constants.rb +15 -6
- data/lib/email_repair/version.rb +1 -1
- data/spec/lib/email_repair/mechanic_spec.rb +2 -3
- data/spec/spec_helper.rb +3 -0
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5a05a9b82471b6775d75156fbeb0b16a3132d66c
|
4
|
+
data.tar.gz: c07996515ed60fe695232d79ddf933abcc58109b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0961e34f144eae29099048426319ee415fa18a96e282fe9601a3837587b377df9ed0dde164967b324527209e1ecdc5e47c1682efece5bd94161138bf4d80866b
|
7
|
+
data.tar.gz: e23896b55901cd351ecc41899d0296993497fbf1a9a0d56343aaff09136e30a274644966f26122916ec3a396fe71acbc8c9ef49dc31d2e5628d7803196ada825
|
data/README.md
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# Email Repair
|
2
2
|
|
3
|
+
[](http://badge.fury.io/rb/email_repair)
|
3
4
|
[](https://travis-ci.org/ChalkSchools/email-repair)
|
5
|
+
[](https://coveralls.io/r/ChalkSchools/email-repair?branch=master)
|
4
6
|
|
5
7
|
TODO: Write a gem description
|
6
8
|
|
@@ -1,12 +1,21 @@
|
|
1
1
|
module EmailRepair
|
2
2
|
class Constants
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
3
|
+
class << self
|
4
|
+
def email_regex
|
5
|
+
local_part_regex = "[#{valid_chars}]" \
|
6
|
+
"([#{valid_chars_with_dot}]*[#{valid_chars}])?"
|
7
|
+
/#{local_part_regex}@(?:[a-z0-9\-]+\.)+(?:museum|travel|[a-z]{2,4})/
|
8
|
+
end
|
9
|
+
|
10
|
+
private
|
11
|
+
|
12
|
+
def valid_chars_with_dot
|
13
|
+
"#{valid_chars}\."
|
14
|
+
end
|
7
15
|
|
8
|
-
|
9
|
-
|
16
|
+
def valid_chars
|
17
|
+
'a-z0-9_%\+\-\''
|
18
|
+
end
|
10
19
|
end
|
11
20
|
end
|
12
21
|
end
|
data/lib/email_repair/version.rb
CHANGED
@@ -2,7 +2,6 @@ require 'spec_helper'
|
|
2
2
|
|
3
3
|
module EmailRepair
|
4
4
|
describe Mechanic, '#repair' do
|
5
|
-
|
6
5
|
let(:mechanic) { Mechanic.new }
|
7
6
|
|
8
7
|
it 'returns clean emails as is' do
|
@@ -26,7 +25,7 @@ module EmailRepair
|
|
26
25
|
end
|
27
26
|
|
28
27
|
it 'returns nil for strings that have no email' do
|
29
|
-
['', ' ', 'NOT AN EMAIL', 'b at b dot com'].each do |not_email|
|
28
|
+
['', ' ', 'NOT AN EMAIL', 'b at b dot com', 'a.@com'].each do |not_email|
|
30
29
|
expect(mechanic.repair(not_email)).to be_nil
|
31
30
|
end
|
32
31
|
end
|
@@ -107,6 +106,7 @@ module EmailRepair
|
|
107
106
|
'one@email.com,another@email.com' => 'one@email.com',
|
108
107
|
'one@email.com;another@email.com' => 'one@email.com',
|
109
108
|
'<one@email.com>' => 'one@email.com',
|
109
|
+
'.one@email.com' => 'one@email.com',
|
110
110
|
}
|
111
111
|
|
112
112
|
dirty_emails.each do |in_mail, out_mail|
|
@@ -125,6 +125,5 @@ module EmailRepair
|
|
125
125
|
expect(mechanic.repair(in_mail)).to eq out_mail
|
126
126
|
end
|
127
127
|
end
|
128
|
-
|
129
128
|
end
|
130
129
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_repair
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Holman Gao
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description:
|
14
14
|
email:
|
@@ -52,3 +52,4 @@ summary: Library to fix invalid emails
|
|
52
52
|
test_files:
|
53
53
|
- spec/lib/email_repair/mechanic_spec.rb
|
54
54
|
- spec/spec_helper.rb
|
55
|
+
has_rdoc:
|