email_repair 2.0.0 → 2.0.1

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5ee85877aa4e7df7d05e7084df4553209c6de6f4d555fe16ddd13070628f5ca5
4
- data.tar.gz: e1ace67bbe8264421ae9c73dd77a7dde04097d694a90fcfae608b21e49d8e3be
3
+ metadata.gz: b61b1b2063f88892f084765ac14f503779b4b8ec762d913be9fa0c8e37c4e9e3
4
+ data.tar.gz: e5dc3b00f01d7f403e7bf2a3424d6054d24980003f3f72232a612b812b17f58a
5
5
  SHA512:
6
- metadata.gz: 58d21040563feed012c9218fb37f94173b895718ba103ff7d626e4dc3edb9c3c2c76f1f4395462522045b8eb88ad2ba393c81e995e709daaf663657a617c6e17
7
- data.tar.gz: 66a4f543f9db2cf547dacfdb4eed8d55d1e9a98a9d6a9b7a2d5ca3ad9461769857458ccf18f02ff3faedc9b508634e0b36e4db13e681ea6f3444786d0fa133fe
6
+ metadata.gz: 1e2a4144f8eda61738f62bdfe3f2530143eb75aca458f9f580e90f5342d9d006aefb87c58bca26784fb5fa8ce82acdc8c69c94ce33f1867849ec5a7d4f8e52a9
7
+ data.tar.gz: 521aaa4e93c7d06e75541d1e2841d60672b453b48a87223984d3972b618ead34b45d89af0fc5d6cdf2943b972358bfe56b8b5a8f79a9d98003ff7bc103bc6149
@@ -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}$/)
@@ -1,3 +1,3 @@
1
1
  module EmailRepair
2
- VERSION = '2.0.0'.freeze
2
+ VERSION = '2.0.1'.freeze
3
3
  end
@@ -123,6 +123,10 @@ module EmailRepair
123
123
  end
124
124
  end
125
125
 
126
+ it 'does not add an extra @ if there is already one' do
127
+ expect(mechanic.repair('bloo@myyahoo.com')).to eq 'bloo@myyahoo.com'
128
+ end
129
+
126
130
  it 'replaces , with .' do
127
131
  expect(mechanic.repair('b@b,com')).to eq 'b@b.com'
128
132
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: email_repair
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.0
4
+ version: 2.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Holman Gao
8
8
  - JT Bowler
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2023-05-01 00:00:00.000000000 Z
12
+ date: 2023-08-21 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: coveralls
@@ -67,7 +67,7 @@ dependencies:
67
67
  - - "~>"
68
68
  - !ruby/object:Gem::Version
69
69
  version: 1.50.2
70
- description:
70
+ description:
71
71
  email:
72
72
  - holman@golmansax.com
73
73
  - jbowler2400@gmail.com
@@ -88,7 +88,7 @@ homepage: https://github.com/ChalkSchools/email-repair
88
88
  licenses:
89
89
  - MIT
90
90
  metadata: {}
91
- post_install_message:
91
+ post_install_message:
92
92
  rdoc_options: []
93
93
  require_paths:
94
94
  - lib
@@ -103,8 +103,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
103
103
  - !ruby/object:Gem::Version
104
104
  version: '0'
105
105
  requirements: []
106
- rubygems_version: 3.4.2
107
- signing_key:
106
+ rubygems_version: 3.4.10
107
+ signing_key:
108
108
  specification_version: 4
109
109
  summary: Library to fix invalid emails
110
110
  test_files: