fat_fingers 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/fat_fingers.rb CHANGED
@@ -12,11 +12,13 @@ class String
12
12
  #
13
13
  # Returns the cleaned String.
14
14
  def clean_up_typoed_email
15
- downcase.gsub(/c\.om$/, ".com")
15
+ downcase.gsub(/(\s|\#|\'|\"|\\)*/, "")
16
+ .gsub(/(\,|\.\.)/, ".")
17
+ .gsub(/c\.om$/, ".com")
16
18
  .gsub(/n\.et$/, ".net")
17
19
  .gsub(/\.com(.)*$/, ".com")
18
20
  .gsub(/\.co[^op]$/, ".com")
19
- .gsub(/(\.|\,|\'|\"|\\)*$/, "")
21
+ .gsub(/\.*$/, "")
20
22
  .gsub(/\.c*(c|i|l|m|n|o|p|0)*m+o*$/,".com")
21
23
  .gsub(/\.(c|v|x)o+(m|n)$/,".com")
22
24
  .gsub(/\.n*t*e*t*$/, ".net")
@@ -26,6 +28,8 @@ class String
26
28
  .gsub(/@g(n|m)*i*a*m*l*i*l*a*\./,"@gmail.")
27
29
  .gsub(/@y*a*h*a*o*\./,"@yahoo.")
28
30
  .gsub(/@h(o|p)*to*m*i*a*l*i*l*a*\./,"@hotmail.")
31
+ .gsub(/[^\.](com|org|net)$/, '.\1')
32
+
29
33
  end
30
34
 
31
35
  end
@@ -52,13 +52,8 @@ class StringTest < MiniTest::Unit::TestCase
52
52
  "test@gmail.cmo",
53
53
  "test@gmail.copm",
54
54
  "test@gmail.xom",
55
- "test@gmail.com,",
56
- "test@gmail.com.",
57
55
  "test@gmail.vom",
58
56
  "test@gmail.comn",
59
- "test@gmail.com'",
60
- "test@gmail.com\"",
61
- "test@gmail.com\\",
62
57
  "test@gmail.comj",
63
58
  "test@gmail.coim",
64
59
  "test@gmail.cpm",
@@ -68,6 +63,20 @@ class StringTest < MiniTest::Unit::TestCase
68
63
  "test@gmail.c0m",
69
64
  "test@gnail.com",
70
65
 
66
+ "te st@gmail.com",
67
+
68
+ "test@gmail.com'",
69
+ "te'st@gmail.com",
70
+ "test@gmail.com\"",
71
+ "test@gmail.com\\",
72
+ "test@gmail.com,",
73
+ "test@gmail.com.",
74
+ "test@gmail,com",
75
+ "test@#gmail.com",
76
+ "test\#@gmail.com",
77
+ "test@gmail..com",
78
+ #"test@gmailcom",
79
+
71
80
  "TEST@GMAIL.COM"
72
81
  ]
73
82
 
@@ -130,7 +139,8 @@ class StringTest < MiniTest::Unit::TestCase
130
139
  "test@something.ne",
131
140
  "test@something.et",
132
141
  "test@something.nte",
133
- "test@something.nett"
142
+ "test@something.nett",
143
+ "test@something.net"
134
144
  ]
135
145
 
136
146
  @good_org = "test@something.org"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fat_fingers
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: