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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2478611e83b838e0f167bdc0e787c011d603ae52
4
- data.tar.gz: 706c5df6c7a189c2a8286ff7cb9c9b573194ea2d
3
+ metadata.gz: 5a05a9b82471b6775d75156fbeb0b16a3132d66c
4
+ data.tar.gz: c07996515ed60fe695232d79ddf933abcc58109b
5
5
  SHA512:
6
- metadata.gz: 1b989bbefba3f3ea48c011b47bda1336791e1519178df3f76cd19c41175484e986002a269948d6f184ac88b26ae1d6b92718cc8768f59aae91aa80a6a9f53109
7
- data.tar.gz: b7ba04723f437e65108f05c1e0a33b143f39a4277b3fc7447327df5a8fcfda8092733acb42e7b18aab604068339f96131b192df6b4e3dd2dd48d222e58c05566
6
+ metadata.gz: 0961e34f144eae29099048426319ee415fa18a96e282fe9601a3837587b377df9ed0dde164967b324527209e1ecdc5e47c1682efece5bd94161138bf4d80866b
7
+ data.tar.gz: e23896b55901cd351ecc41899d0296993497fbf1a9a0d56343aaff09136e30a274644966f26122916ec3a396fe71acbc8c9ef49dc31d2e5628d7803196ada825
data/README.md CHANGED
@@ -1,6 +1,8 @@
1
1
  # Email Repair
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/email_repair.svg)](http://badge.fury.io/rb/email_repair)
3
4
  [![Build Status](https://travis-ci.org/ChalkSchools/email-repair.svg?branch=master)](https://travis-ci.org/ChalkSchools/email-repair)
5
+ [![Coverage Status](https://img.shields.io/coveralls/ChalkSchools/email-repair.svg)](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
- def self.email_regex
4
- local_part_regex = "[#{email_local_part_valid_chars}]+"
5
- /#{local_part_regex}@(?:[a-z0-9\-]+\.)+(?:museum|travel|[a-z]{2,4})/
6
- end
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
- def self.email_local_part_valid_chars
9
- 'a-z0-9_\.%\+\-\''
16
+ def valid_chars
17
+ 'a-z0-9_%\+\-\''
18
+ end
10
19
  end
11
20
  end
12
21
  end
@@ -1,3 +1,3 @@
1
1
  module EmailRepair
2
- VERSION = '0.0.1'
2
+ VERSION = '0.0.2'
3
3
  end
@@ -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
@@ -1,3 +1,6 @@
1
+ require 'coveralls'
2
+ Coveralls.wear!
3
+
1
4
  require_relative '../lib/email_repair'
2
5
 
3
6
  RSpec.configure do |config|
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.1
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: 2014-07-25 00:00:00.000000000 Z
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: