slugalizer 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/slugalizer.rb +8 -10
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fd9cc7b18ecbeb3c4a69d3f0658b7cb389615822
4
- data.tar.gz: e97033448a7c1a6cb4fe4a997c87bb4f74be01df
3
+ metadata.gz: 18c58c042f68b52c179f3e6d5657b95c6112e4fb
4
+ data.tar.gz: 0fce5b8b003e4ccee693ad0ad33977f8f617c1c5
5
5
  SHA512:
6
- metadata.gz: fd622774d9ec6588f47137406a662148cb1ba092ba71e8cceb33e62b6fbbf81a7dc60a652d7b5a1f6b3343937ff599f64d55b68e4f2bb3a730f4c6d5781e3e32
7
- data.tar.gz: 0a4cb184efcda5980fdf01a2d1d7361e5fcfa301be12950aa8fcfe4795a21f1b030279464da6b7e5dec13b5981304e7c4b40df83c3c35b4802d845a2a289f907
6
+ metadata.gz: 83b40823766c4165b75c00aba8712b395c10674255a728f63fd383688aa5ce576828f3c926864fde0e6ac194b2aafa5e042a74c060f007396f492262dfc6ccda
7
+ data.tar.gz: fd8f3bb3a080956b26f562065100adf2c5dd252af5cc4b4d8285813cd801d0a1bc028dc2733d29b5c0a3ca94f0811afc1d580f7650cc7f026c214ca37d8952d5
data/lib/slugalizer.rb CHANGED
@@ -2,25 +2,23 @@ module Slugalizer
2
2
  extend self
3
3
 
4
4
  def to_slug(string = '')
5
- #strip the string
5
+ # strip the string
6
6
  ret = string.strip
7
7
 
8
- #blow away apostrophes
9
- ret.gsub! /['`]/,""
8
+ # blow away apostrophes and dots
9
+ ret.gsub! /['`\.]/,""
10
10
 
11
- #replace all non alphanumeric or periods with underscore
12
- ret.gsub! /\s*[^A-Za-z0-9\.\_]\s*/, '-'
13
- ret.gsub! /_/, '-'
11
+ # replace all non alphanumeric with dashes
12
+ ret.gsub! /\s*[^A-Za-z0-9]\s*/, '-'
14
13
 
15
- #convert double dashes to single
14
+ # convert double dashes to single
16
15
  ret.gsub! /-+/,"-"
17
16
 
18
- #strip off leading/trailing dashes
17
+ # strip off leading/trailing dashes
19
18
  ret.gsub! /\A[-\.]+|[-\.]+\z/,""
20
19
 
21
- #transfor to downcase
20
+ # transfor to downcase
22
21
  ret.downcase!
23
-
24
22
  ret
25
23
  end
26
24
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: slugalizer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Aguilar