email_typo 0.1.0 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.github/FUNDING.yml +3 -0
- data/.rubocop.yml +9 -0
- data/.travis.yml +9 -4
- data/Gemfile +2 -0
- data/README.md +31 -13
- data/Rakefile +6 -1
- data/bin/console +1 -0
- data/email_typo.gemspec +6 -3
- data/fat_finger_last_commit +1 -0
- data/lib/email_typo.rb +12 -1
- data/lib/email_typo/add_missing_period.rb +1 -1
- data/lib/email_typo/different_tlds.rb +1 -0
- data/lib/email_typo/dot_com.rb +2 -2
- data/lib/email_typo/fix_extraneous_letter_dot_com.rb +8 -0
- data/lib/email_typo/gmail.rb +4 -1
- data/lib/email_typo/googlemail.rb +4 -1
- data/lib/email_typo/hotmail.rb +1 -1
- data/lib/email_typo/icloud.rb +7 -0
- data/lib/email_typo/known_dot_com.rb +4 -1
- data/lib/email_typo/remove_invalid_chars.rb +2 -2
- data/lib/email_typo/remove_mailto.rb +7 -0
- data/lib/email_typo/version.rb +3 -1
- metadata +32 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 7af77ce6834bcf79d5e52edd538a7c40ade7d33d0a664c27e6e56ee175421f8c
|
4
|
+
data.tar.gz: beab6f40f8e612064e843cd54c1ce0d9eb20cd68417729bd4e7977506a045bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7bd414559f8b4adbef3f637782d0ba5601072984a553434352f6408f8192ce03a4f5cffdd42700177d74f89c86387d9ddc2e2dd477f6975829551f56582e919
|
7
|
+
data.tar.gz: b0c8c59abf06b3d25f45ceba5d703d9286a29c7c4ec6bf4a12374c71b939003017eb090d8c48e3fdb46d8264d7815c67ced55f3a0b14ae14d5df9569bc04eebc
|
data/.github/FUNDING.yml
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
CHANGED
@@ -1,14 +1,19 @@
|
|
1
|
+
---
|
1
2
|
sudo: false
|
2
3
|
cache: bundler
|
3
4
|
language: ruby
|
4
5
|
rvm:
|
5
|
-
- 2.
|
6
|
+
- "2.7"
|
6
7
|
before_install: gem install bundler
|
7
8
|
script: bundle exec rake
|
8
9
|
notifications:
|
9
10
|
email: false
|
10
|
-
|
11
|
-
-
|
11
|
+
before_script:
|
12
|
+
- curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
|
13
|
+
- chmod +x ./cc-test-reporter
|
14
|
+
- "./cc-test-reporter before-build"
|
15
|
+
after_script:
|
16
|
+
- "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
|
12
17
|
env:
|
13
18
|
global:
|
14
|
-
secure:
|
19
|
+
secure: XU0SxxhufYnJNYC88bsAHseHtK4fd12B97b7NwHxnND9dDbUPCuGI9mkt06wTZchWnB4nDuS4SF6ib73zAP1JI3m7f2FyazAqrgm/OneXy8GYVQtbrG2+1XObSMc7ONX8K/+VGVnZi2nHO3XyC7VRWQreppVK8U24P7qNpJzmWUTy8XqvJT0ZTupELhbikh1cY1np/ammV4eX6QwoeSDd0Wx5QM4D/P06NEXqQ7PdYBBIDuB8zFwSZLh/Q8wNDiOwcUVJTULh/nLmdGMclCcp/aRPrbbWk01scS3khqiJK8SfujeDYNJeuaECGm/9r9MZHvH9Qd88aUJBZcxJRXJiZJ6xuYvc7WnF8tNxGp8xNYTr9/YJrUPPMDdoLr50LyXiY1wf3A0dQHdGNIv5gd7pMoEK+kg0dkqcnhg6OQNRkihudbFuORdKRocIVzHgxB3We+FBnqfexgzLNoYU3eJB3IL8nS0dRX2lSP36SDXTkZNUxflDgGLmoz//FRll3WJ1VsGOkZqBPA2TMoRxqLyhaVnXuPS5uiBUu4gAC4df4HWPAtM1LFtI1HvMenKOYFDqjrPqLevtmQTP/72zl84GAA3hoBGnPgOh2GBtAo/nn5ExbWQUfHSYMwSVD3rrMhe5Lt7G6mzg8hkGU7hYOKwrfSUq/i3+omS0gwHEUBh2vQ=
|
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -1,18 +1,24 @@
|
|
1
1
|
# EmailTypo
|
2
2
|
|
3
|
-
[![Travis-CI](https://travis-ci.org/fnando/email_typo.
|
3
|
+
[![Travis-CI](https://travis-ci.org/fnando/email_typo.svg)](https://travis-ci.org/fnando/email_typo)
|
4
4
|
[![Code Climate](https://codeclimate.com/github/fnando/email_typo/badges/gpa.svg)](https://codeclimate.com/github/fnando/email_typo)
|
5
|
-
[![Test Coverage](https://codeclimate.com/github/fnando/email_typo/badges/coverage.svg)](https://codeclimate.com/github/fnando/email_typo/coverage)
|
6
5
|
[![Gem](https://img.shields.io/gem/v/email_typo.svg)](https://rubygems.org/gems/email_typo)
|
7
6
|
[![Gem](https://img.shields.io/gem/dt/email_typo.svg)](https://rubygems.org/gems/email_typo)
|
8
7
|
|
9
|
-
EmailTypo is a Ruby gem that gives you an easy, tested method that fixes email
|
8
|
+
EmailTypo is a Ruby gem that gives you an easy, tested method that fixes email
|
9
|
+
typos.
|
10
10
|
|
11
|
-
As an example: A user with the email "joe@gmail.com" accidentally enters in
|
11
|
+
As an example: A user with the email "joe@gmail.com" accidentally enters in
|
12
|
+
"joe@gmal.cmo", EmailTypo will fix it automatically.
|
12
13
|
|
13
|
-
EmailTypo is concerned with incorrectly-entered data (email provider names,
|
14
|
+
EmailTypo is concerned with incorrectly-entered data (email provider names,
|
15
|
+
TLDs), not with evaluating whether a particular domain is valid, or whether a
|
16
|
+
particular email address is legitimate. (That is, it's focused on fixing the
|
17
|
+
part that comes after the "@" in the email address.) It works really well for
|
18
|
+
helping you — and your users — when they accidentally type something in wrong.
|
14
19
|
|
15
|
-
**NOTE**: This is based on https://github.com/charliepark/fat_fingers, but
|
20
|
+
**NOTE**: This is based on https://github.com/charliepark/fat_fingers, but
|
21
|
+
without polluting the `String` class and with easier extension support.
|
16
22
|
|
17
23
|
## Installation
|
18
24
|
|
@@ -32,14 +38,16 @@ Or install it yourself as:
|
|
32
38
|
|
33
39
|
## Usage
|
34
40
|
|
35
|
-
To fix any typos, just use `EmailTypo.
|
41
|
+
To fix any typos, just use `EmailTypo.call(email)`.
|
36
42
|
|
37
43
|
```ruby
|
38
|
-
EmailTypo.
|
44
|
+
EmailTypo.call("john.doe@gmail.co")
|
39
45
|
#=> "john.doe@gmail.com"
|
40
46
|
```
|
41
47
|
|
42
|
-
To add/change the processors, add any object that responds to `#call(email)` to
|
48
|
+
To add/change the processors, add any object that responds to `#call(email)` to
|
49
|
+
`EmailTypo.default_processors`. The following example adds a processor for
|
50
|
+
`.uol.com.br`, a Brazilian email provider:
|
43
51
|
|
44
52
|
```ruby
|
45
53
|
EmailTypo.default_processors << lambda do |email|
|
@@ -49,14 +57,24 @@ end
|
|
49
57
|
|
50
58
|
## Development
|
51
59
|
|
52
|
-
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
60
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run
|
61
|
+
`rake test` to run the tests. You can also run `bin/console` for an interactive
|
62
|
+
prompt that will allow you to experiment.
|
53
63
|
|
54
|
-
To install this gem onto your local machine, run `bundle exec rake install`. To
|
64
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To
|
65
|
+
release a new version, update the version number in `version.rb`, and then run
|
66
|
+
`bundle exec rake release`, which will create a git tag for the version, push
|
67
|
+
git commits and tags, and push the `.gem` file to
|
68
|
+
[rubygems.org](https://rubygems.org).
|
55
69
|
|
56
70
|
## Contributing
|
57
71
|
|
58
|
-
Bug reports and pull requests are welcome on GitHub at
|
72
|
+
Bug reports and pull requests are welcome on GitHub at
|
73
|
+
https://github.com/fnando/email_typo. This project is intended to be a safe,
|
74
|
+
welcoming space for collaboration, and contributors are expected to adhere to
|
75
|
+
the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
59
76
|
|
60
77
|
## License
|
61
78
|
|
62
|
-
The gem is available as open source under the terms of the
|
79
|
+
The gem is available as open source under the terms of the
|
80
|
+
[MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,5 +1,8 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require "bundler/gem_tasks"
|
2
4
|
require "rake/testtask"
|
5
|
+
require "rubocop/rake_task"
|
3
6
|
|
4
7
|
Rake::TestTask.new(:test) do |t|
|
5
8
|
t.libs << "test"
|
@@ -7,4 +10,6 @@ Rake::TestTask.new(:test) do |t|
|
|
7
10
|
t.test_files = FileList["test/**/*_test.rb"]
|
8
11
|
end
|
9
12
|
|
10
|
-
|
13
|
+
RuboCop::RakeTask.new
|
14
|
+
|
15
|
+
task default: %i[test rubocop]
|
data/bin/console
CHANGED
data/email_typo.gemspec
CHANGED
@@ -7,8 +7,10 @@ Gem::Specification.new do |spec|
|
|
7
7
|
spec.version = EmailTypo::VERSION
|
8
8
|
spec.authors = ["Nando Vieira"]
|
9
9
|
spec.email = ["fnando.vieira@gmail.com"]
|
10
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.3.0")
|
10
11
|
|
11
|
-
spec.summary
|
12
|
+
spec.summary = "Clean up e-mail strings when the user's made a typo " \
|
13
|
+
"(like 'gmail.cmo')."
|
12
14
|
spec.description = spec.summary
|
13
15
|
spec.homepage = "https://github.com/fnando/email_typo"
|
14
16
|
spec.license = "MIT"
|
@@ -21,9 +23,10 @@ Gem::Specification.new do |spec|
|
|
21
23
|
spec.require_paths = ["lib"]
|
22
24
|
|
23
25
|
spec.add_development_dependency "bundler"
|
24
|
-
spec.add_development_dependency "rake"
|
25
26
|
spec.add_development_dependency "minitest-utils"
|
26
27
|
spec.add_development_dependency "pry-meta"
|
28
|
+
spec.add_development_dependency "rake"
|
29
|
+
spec.add_development_dependency "rubocop"
|
30
|
+
spec.add_development_dependency "rubocop-fnando"
|
27
31
|
spec.add_development_dependency "simplecov"
|
28
|
-
spec.add_development_dependency "codeclimate-test-reporter"
|
29
32
|
end
|
@@ -0,0 +1 @@
|
|
1
|
+
3b87d86575161d0f7b2b0d327c98b549db726096
|
data/lib/email_typo.rb
CHANGED
@@ -9,13 +9,16 @@ require_relative "./email_typo/different_tlds"
|
|
9
9
|
require_relative "./email_typo/dot_com"
|
10
10
|
require_relative "./email_typo/dot_net"
|
11
11
|
require_relative "./email_typo/dot_org"
|
12
|
+
require_relative "./email_typo/fix_extraneous_letter_dot_com"
|
12
13
|
require_relative "./email_typo/gmail"
|
13
14
|
require_relative "./email_typo/googlemail"
|
14
15
|
require_relative "./email_typo/hotmail"
|
16
|
+
require_relative "./email_typo/icloud"
|
15
17
|
require_relative "./email_typo/known_dot_com"
|
16
18
|
require_relative "./email_typo/period_around_at_sign"
|
17
19
|
require_relative "./email_typo/providers"
|
18
20
|
require_relative "./email_typo/remove_invalid_chars"
|
21
|
+
require_relative "./email_typo/remove_mailto"
|
19
22
|
require_relative "./email_typo/transposed_periods"
|
20
23
|
require_relative "./email_typo/yahoo"
|
21
24
|
|
@@ -26,10 +29,12 @@ module EmailTypo
|
|
26
29
|
end
|
27
30
|
|
28
31
|
self.default_processors = [
|
32
|
+
RemoveMailTo,
|
29
33
|
RemoveInvalidChars,
|
30
34
|
TransposedPeriods,
|
31
35
|
PeriodAroundAtSign,
|
32
36
|
DifferentTlds,
|
37
|
+
FixExtraneousLetterDotCom,
|
33
38
|
AddMissingM,
|
34
39
|
AddMissingPeriod,
|
35
40
|
Providers,
|
@@ -40,15 +45,21 @@ module EmailTypo
|
|
40
45
|
Gmail,
|
41
46
|
Googlemail,
|
42
47
|
Hotmail,
|
48
|
+
Icloud,
|
43
49
|
KnownDotCom,
|
44
50
|
Yahoo
|
45
51
|
]
|
46
52
|
|
47
|
-
def self.
|
53
|
+
def self.call(email, processors = default_processors)
|
48
54
|
return unless email
|
49
55
|
|
50
56
|
processors.reduce(email.downcase) do |processed_email, processor|
|
51
57
|
processor.call(processed_email)
|
52
58
|
end
|
53
59
|
end
|
60
|
+
|
61
|
+
def self.fix(email, processors = default_processors)
|
62
|
+
warn "EmailTypo.fix is deprecated; use EmailTypo.call instead."
|
63
|
+
call(email, processors)
|
64
|
+
end
|
54
65
|
end
|
data/lib/email_typo/dot_com.rb
CHANGED
@@ -7,7 +7,7 @@ module EmailTypo
|
|
7
7
|
.gsub(/\.com\.$/, ".com")
|
8
8
|
.gsub(/\.com(?!cast|\.|@).{1,3}$/, ".com")
|
9
9
|
.gsub(/\.co[^op]$/, ".com")
|
10
|
-
.gsub(/\.c*(c|ci|coi|l|m|n|o|op|cp|0)*m+o*$/, ".com")
|
11
|
-
.gsub(/\.(c|v|x)o+(m|n)$/, ".com")
|
10
|
+
.gsub(/\.c*(c|ck|ci|coi|l|m|n|o|op|cp|0|9)*m+o*$/, ".com")
|
11
|
+
.gsub(/\.(c|f|v|x)o+(m|n)$/, ".com")
|
12
12
|
end
|
13
13
|
end
|
data/lib/email_typo/gmail.rb
CHANGED
data/lib/email_typo/hotmail.rb
CHANGED
data/lib/email_typo/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: email_typo
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nando Vieira
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -25,7 +25,7 @@ dependencies:
|
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: minitest-utils
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - ">="
|
@@ -39,7 +39,7 @@ dependencies:
|
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name:
|
42
|
+
name: pry-meta
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - ">="
|
@@ -53,7 +53,7 @@ dependencies:
|
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name:
|
56
|
+
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - ">="
|
@@ -67,7 +67,21 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: rubocop
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rubocop-fnando
|
71
85
|
requirement: !ruby/object:Gem::Requirement
|
72
86
|
requirements:
|
73
87
|
- - ">="
|
@@ -81,7 +95,7 @@ dependencies:
|
|
81
95
|
- !ruby/object:Gem::Version
|
82
96
|
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
98
|
+
name: simplecov
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
86
100
|
requirements:
|
87
101
|
- - ">="
|
@@ -101,7 +115,9 @@ executables: []
|
|
101
115
|
extensions: []
|
102
116
|
extra_rdoc_files: []
|
103
117
|
files:
|
118
|
+
- ".github/FUNDING.yml"
|
104
119
|
- ".gitignore"
|
120
|
+
- ".rubocop.yml"
|
105
121
|
- ".travis.yml"
|
106
122
|
- CODE_OF_CONDUCT.md
|
107
123
|
- Gemfile
|
@@ -111,6 +127,7 @@ files:
|
|
111
127
|
- bin/console
|
112
128
|
- bin/setup
|
113
129
|
- email_typo.gemspec
|
130
|
+
- fat_finger_last_commit
|
114
131
|
- lib/email_typo.rb
|
115
132
|
- lib/email_typo/add_missing_m.rb
|
116
133
|
- lib/email_typo/add_missing_period.rb
|
@@ -119,13 +136,16 @@ files:
|
|
119
136
|
- lib/email_typo/dot_com.rb
|
120
137
|
- lib/email_typo/dot_net.rb
|
121
138
|
- lib/email_typo/dot_org.rb
|
139
|
+
- lib/email_typo/fix_extraneous_letter_dot_com.rb
|
122
140
|
- lib/email_typo/gmail.rb
|
123
141
|
- lib/email_typo/googlemail.rb
|
124
142
|
- lib/email_typo/hotmail.rb
|
143
|
+
- lib/email_typo/icloud.rb
|
125
144
|
- lib/email_typo/known_dot_com.rb
|
126
145
|
- lib/email_typo/period_around_at_sign.rb
|
127
146
|
- lib/email_typo/providers.rb
|
128
147
|
- lib/email_typo/remove_invalid_chars.rb
|
148
|
+
- lib/email_typo/remove_mailto.rb
|
129
149
|
- lib/email_typo/transposed_periods.rb
|
130
150
|
- lib/email_typo/version.rb
|
131
151
|
- lib/email_typo/yahoo.rb
|
@@ -133,7 +153,7 @@ homepage: https://github.com/fnando/email_typo
|
|
133
153
|
licenses:
|
134
154
|
- MIT
|
135
155
|
metadata: {}
|
136
|
-
post_install_message:
|
156
|
+
post_install_message:
|
137
157
|
rdoc_options: []
|
138
158
|
require_paths:
|
139
159
|
- lib
|
@@ -141,16 +161,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
141
161
|
requirements:
|
142
162
|
- - ">="
|
143
163
|
- !ruby/object:Gem::Version
|
144
|
-
version:
|
164
|
+
version: 2.3.0
|
145
165
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
146
166
|
requirements:
|
147
167
|
- - ">="
|
148
168
|
- !ruby/object:Gem::Version
|
149
169
|
version: '0'
|
150
170
|
requirements: []
|
151
|
-
|
152
|
-
|
153
|
-
signing_key:
|
171
|
+
rubygems_version: 3.1.2
|
172
|
+
signing_key:
|
154
173
|
specification_version: 4
|
155
174
|
summary: Clean up e-mail strings when the user's made a typo (like 'gmail.cmo').
|
156
175
|
test_files: []
|