email_typo 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8d425440669c8ea1663c905191c1748c765b6dcc83d5bb1011f82d176f48e182
4
- data.tar.gz: 8b83a3d9aca571a9e3f26db7229bd8f9debf27dda0d5ac46a4f402a179b8946a
3
+ metadata.gz: 003afe832444fb5fef539a76eaf15aa14b61527314d317e8e58b3f4d3b455d57
4
+ data.tar.gz: 6afc7f99e881f60184ee6800af1b6e40e8504bdbec58a08dd2ee34a7a0ecc39e
5
5
  SHA512:
6
- metadata.gz: bf2b5ed00b8c5457a5c7ee4ecf6bc35fe646e3115557a4c55464d5758be4a4e98be1bdf63c82f110685828a479df5a26b3baa84700835105a5dc442505c1e175
7
- data.tar.gz: bd540060d6afa7e3fdf4675279679b3bb097f397b5e9a83811e559d24894547ae7181185980e4baabe095b3a015a4ef07109efce09d4e2488b65b215cc4b8992
6
+ metadata.gz: f25cd3d6f99c666f44aab3e4a5df551f5d6d27e30420175d1b0511c11f867c1c9d4c9cadb06c034f6e38693490460a8e4a830c1771d0ef1b304385510edb360e
7
+ data.tar.gz: 666957586c33bbed0fc7176eb501440a968542cf0d776956f81299687fad743aa933a2329d723d143482e411a814de0ceaaae157775613e95206cd7848f60274
data/.rubocop.yml CHANGED
@@ -1,126 +1,6 @@
1
- AllCops:
2
- Exclude:
3
- - "bin/**/*"
4
- - "gemfiles/**/*"
5
- - "vendor/**/*"
6
- - "Gemfile"
7
- - "Rakefile"
8
- - "*.gemspec"
9
- - "config.ru"
10
-
11
- Style/Alias:
12
- EnforcedStyle: prefer_alias_method
13
-
14
- Style/FrozenStringLiteralComment:
15
- EnforcedStyle: always
16
-
17
- Style/ClassCheck:
18
- EnforcedStyle: kind_of?
19
-
20
- Metrics/LineLength:
21
- Max: 80
22
-
23
- Style/BlockDelimiters:
24
- Enabled: false
25
-
26
- Style/RegexpLiteral:
27
- Enabled: false
28
-
29
- Metrics/AbcSize:
30
- Enabled: false
31
-
32
- Style/PerlBackrefs:
33
- Enabled: false
34
-
35
- ClassLength:
36
- Enabled: false
37
-
38
- CyclomaticComplexity:
39
- Enabled: false
40
-
41
- Documentation:
42
- Enabled: false
43
-
44
- Encoding:
45
- Enabled: false
46
-
47
- FileName:
48
- Enabled: false
49
-
50
- IfUnlessModifier:
51
- Enabled: false
52
-
53
- MethodLength:
54
- Enabled: false
55
-
56
- ModuleFunction:
57
- Enabled: false
1
+ ---
2
+ inherit_gem:
3
+ rubocop-fnando: .rubocop.yml
58
4
 
59
- OneLineConditional:
60
- Enabled: false
61
-
62
- ParameterLists:
63
- Enabled: false
64
-
65
- Proc:
66
- Enabled: false
67
-
68
- SingleLineBlockParams:
69
- Enabled: false
70
-
71
- VariableInterpolation:
72
- Enabled: false
73
-
74
- Style/TrailingCommaInLiteral:
75
- Enabled: false
76
-
77
- WhileUntilModifier:
78
- Enabled: false
79
-
80
- PredicateName:
81
- NamePrefixBlacklist:
82
- - is_
83
-
84
- StringLiterals:
85
- EnforcedStyle: double_quotes
86
- SupportedStyles:
87
- - single_quotes
88
- - double_quotes
89
-
90
- DotPosition:
91
- EnforcedStyle: leading
92
-
93
- SpaceBeforeBlockBraces:
94
- EnforcedStyle: space
95
-
96
- SpaceInsideBlockBraces:
97
- EnforcedStyle: no_space
98
-
99
- DoubleNegation:
100
- Enabled: false
101
-
102
- SpaceInsideBlockBraces:
103
- SpaceBeforeBlockParameters: false
104
-
105
- SpaceInsideHashLiteralBraces:
106
- Enabled: false
107
-
108
- PercentLiteralDelimiters:
109
- PreferredDelimiters:
110
- '%': '[]'
111
- '%i': '[]'
112
- '%q': '[]'
113
- '%Q': '[]'
114
- '%r': '[]'
115
- '%s': '[]'
116
- '%w': '[]'
117
- '%W': '[]'
118
- '%x': '[]'
119
-
120
- Style/CollectionMethods:
121
- PreferredMethods:
122
- collect: 'map'
123
- collect!: 'map!'
124
- inject: 'reduce'
125
- detect: 'find'
126
- find_all: 'select'
5
+ AllCops:
6
+ TargetRubyVersion: 2.7
data/.travis.yml CHANGED
@@ -1,18 +1,19 @@
1
+ ---
1
2
  sudo: false
2
3
  cache: bundler
3
4
  language: ruby
4
5
  rvm:
5
- - 2.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
  before_script:
11
- - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
12
- - chmod +x ./cc-test-reporter
13
- - "./cc-test-reporter before-build"
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"
14
15
  after_script:
15
- - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
16
+ - "./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT"
16
17
  env:
17
18
  global:
18
19
  secure: XU0SxxhufYnJNYC88bsAHseHtK4fd12B97b7NwHxnND9dDbUPCuGI9mkt06wTZchWnB4nDuS4SF6ib73zAP1JI3m7f2FyazAqrgm/OneXy8GYVQtbrG2+1XObSMc7ONX8K/+VGVnZi2nHO3XyC7VRWQreppVK8U24P7qNpJzmWUTy8XqvJT0ZTupELhbikh1cY1np/ammV4eX6QwoeSDd0Wx5QM4D/P06NEXqQ7PdYBBIDuB8zFwSZLh/Q8wNDiOwcUVJTULh/nLmdGMclCcp/aRPrbbWk01scS3khqiJK8SfujeDYNJeuaECGm/9r9MZHvH9Qd88aUJBZcxJRXJiZJ6xuYvc7WnF8tNxGp8xNYTr9/YJrUPPMDdoLr50LyXiY1wf3A0dQHdGNIv5gd7pMoEK+kg0dkqcnhg6OQNRkihudbFuORdKRocIVzHgxB3We+FBnqfexgzLNoYU3eJB3IL8nS0dRX2lSP36SDXTkZNUxflDgGLmoz//FRll3WJ1VsGOkZqBPA2TMoRxqLyhaVnXuPS5uiBUu4gAC4df4HWPAtM1LFtI1HvMenKOYFDqjrPqLevtmQTP/72zl84GAA3hoBGnPgOh2GBtAo/nn5ExbWQUfHSYMwSVD3rrMhe5Lt7G6mzg8hkGU7hYOKwrfSUq/i3+omS0gwHEUBh2vQ=
data/Gemfile CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  source "https://rubygems.org"
2
4
 
3
5
  # Specify your gem's dependencies in email_typo.gemspec
data/README.md CHANGED
@@ -32,10 +32,10 @@ Or install it yourself as:
32
32
 
33
33
  ## Usage
34
34
 
35
- To fix any typos, just use `EmailTypo.fix(email)`.
35
+ To fix any typos, just use `EmailTypo.call(email)`.
36
36
 
37
37
  ```ruby
38
- EmailTypo.fix("john.doe@gmail.co")
38
+ EmailTypo.call("john.doe@gmail.co")
39
39
  #=> "john.doe@gmail.com"
40
40
  ```
41
41
 
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
- task :default => :test
13
+ RuboCop::RakeTask.new
14
+
15
+ task default: %i[test rubocop]
data/bin/console CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
2
3
 
3
4
  require "bundler/setup"
4
5
  require "email_typo"
data/email_typo.gemspec CHANGED
@@ -8,7 +8,9 @@ Gem::Specification.new do |spec|
8
8
  spec.authors = ["Nando Vieira"]
9
9
  spec.email = ["fnando.vieira@gmail.com"]
10
10
 
11
- spec.summary = "Clean up e-mail strings when the user's made a typo (like 'gmail.cmo')."
11
+ spec.summary = %w[
12
+ Clean up e-mail strings when the user's made a typo (like 'gmail.cmo').
13
+ ].join(" ")
12
14
  spec.description = spec.summary
13
15
  spec.homepage = "https://github.com/fnando/email_typo"
14
16
  spec.license = "MIT"
@@ -21,8 +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
32
  end
data/lib/email_typo.rb CHANGED
@@ -9,6 +9,7 @@ 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"
@@ -33,6 +34,7 @@ module EmailTypo
33
34
  TransposedPeriods,
34
35
  PeriodAroundAtSign,
35
36
  DifferentTlds,
37
+ FixExtraneousLetterDotCom,
36
38
  AddMissingM,
37
39
  AddMissingPeriod,
38
40
  Providers,
@@ -48,11 +50,16 @@ module EmailTypo
48
50
  Yahoo
49
51
  ]
50
52
 
51
- def self.fix(email, processors = default_processors)
53
+ def self.call(email, processors = default_processors)
52
54
  return unless email
53
55
 
54
56
  processors.reduce(email.downcase) do |processed_email, processor|
55
57
  processor.call(processed_email)
56
58
  end
57
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
58
65
  end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module EmailTypo
4
+ FixExtraneousLetterDotCom = lambda do |email|
5
+ email
6
+ .gsub(/\..com$/, ".com")
7
+ end
8
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module EmailTypo
4
4
  Icloud = lambda do |email|
5
- email.gsub(/@icl{0,2}(?:uo|u|o)d\./, "@icloud.")
5
+ email.gsub(/@icl{0,2}(?:uo|u|o)?d\./, "@icloud.")
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module EmailTypo
4
- VERSION = "0.1.2".freeze
4
+ VERSION = "0.2.0"
5
5
  end
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.1.2
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nando Vieira
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-07-14 00:00:00.000000000 Z
11
+ date: 2020-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -24,6 +24,34 @@ dependencies:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: minitest-utils
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - ">="
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: pry-meta
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - ">="
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - ">="
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: rake
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -39,7 +67,7 @@ dependencies:
39
67
  - !ruby/object:Gem::Version
40
68
  version: '0'
41
69
  - !ruby/object:Gem::Dependency
42
- name: minitest-utils
70
+ name: rubocop
43
71
  requirement: !ruby/object:Gem::Requirement
44
72
  requirements:
45
73
  - - ">="
@@ -53,7 +81,7 @@ dependencies:
53
81
  - !ruby/object:Gem::Version
54
82
  version: '0'
55
83
  - !ruby/object:Gem::Dependency
56
- name: pry-meta
84
+ name: rubocop-fnando
57
85
  requirement: !ruby/object:Gem::Requirement
58
86
  requirements:
59
87
  - - ">="
@@ -106,6 +134,7 @@ files:
106
134
  - lib/email_typo/dot_com.rb
107
135
  - lib/email_typo/dot_net.rb
108
136
  - lib/email_typo/dot_org.rb
137
+ - lib/email_typo/fix_extraneous_letter_dot_com.rb
109
138
  - lib/email_typo/gmail.rb
110
139
  - lib/email_typo/googlemail.rb
111
140
  - lib/email_typo/hotmail.rb
@@ -137,7 +166,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
137
166
  - !ruby/object:Gem::Version
138
167
  version: '0'
139
168
  requirements: []
140
- rubygems_version: 3.0.3
169
+ rubygems_version: 3.1.2
141
170
  signing_key:
142
171
  specification_version: 4
143
172
  summary: Clean up e-mail strings when the user's made a typo (like 'gmail.cmo').