slugalizer 0.0.4 → 0.0.5

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
  SHA1:
3
- metadata.gz: 6f8dcf9b5dde26d04b172317716aff7939c3eb85
4
- data.tar.gz: 4d6b13672ad9bcdee8c92afaa37767d23829f188
3
+ metadata.gz: 618ffa995db619844163ad93d3be2d8d204dc646
4
+ data.tar.gz: 561def36959b279639ed6530a3d42e7f7ebfa512
5
5
  SHA512:
6
- metadata.gz: dc067cb437649ceb41041f2c66a97a24e32b041540bbc09e0ae03648f295794bd877f8d306ecc36082eb027cef4ce21cac22a11e68078d9f521b7a757d9634dc
7
- data.tar.gz: 86c61b07decb213bb09b1660fc7b256077874418402b524ae19d3a8a186a0f06185f4d4ba472e05a776588a351775597210c4c3d6e4f9250fb6d4004d8635b82
6
+ metadata.gz: e7f8c16591c3e0b9b051c7041b113ce21ca37495a3abcf19d065992040a377404fe6946c6fb2f2399993eed221e75fa03ae85e189c6cef7ab33bfca0c1d830a5
7
+ data.tar.gz: 8412f9ca8bc192c33ae7ed26f4f04c909633c7d83f24c679884e9e03a280ada02b4f6bfa2647a554cf620ffbc91f32ce36665c66805fb40d2bb614241edba7e5
@@ -0,0 +1,13 @@
1
+ require 'slugalizer'
2
+
3
+ class String
4
+ def to_slug
5
+ Slugalizer.to_slug self
6
+ end
7
+ end
8
+
9
+ class NilClass
10
+ def to_slug
11
+ ''
12
+ end
13
+ end
data/lib/slugalizer.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  module Slugalizer
2
- extend self
2
+ def self.to_slug(string = '')
3
+ return '' if string.nil?
3
4
 
4
- def to_slug(string = '')
5
5
  # strip the string
6
6
  ret = string.strip
7
7
 
@@ -17,8 +17,7 @@ module Slugalizer
17
17
  # strip off leading/trailing dashes
18
18
  ret.gsub! /\A[-\.]+|[-\.]+\z/,""
19
19
 
20
- # transfor to downcase
21
- ret.downcase!
22
- ret
20
+ # transform to downcase
21
+ ret.downcase
23
22
  end
24
23
  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.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Martín Aguilar
@@ -66,13 +66,14 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
- description: ''
69
+ description: Generate slugs for your models with this tiny tiny gem.
70
70
  email: martinaguilar@outlook.com
71
71
  executables: []
72
72
  extensions: []
73
73
  extra_rdoc_files: []
74
74
  files:
75
75
  - lib/slugalizer.rb
76
+ - lib/slugalizer/sugar.rb
76
77
  homepage: http://rubygems.org/gems/slugalizer
77
78
  licenses:
78
79
  - MIT