fat_fingers 0.1.3 → 0.1.4
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.
- data/lib/fat_fingers.rb +6 -2
 - data/test/test_fat_fingers.rb +16 -6
 - metadata +1 -1
 
    
        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(/ 
     | 
| 
      
 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
         
     | 
    
        data/test/test_fat_fingers.rb
    CHANGED
    
    | 
         @@ -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"
         
     |