gtl-sluggable 0.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/lib/gtl-sluggable.rb +25 -0
- metadata +43 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 0b1e125ace6888e5dcf5bc3b66007a1972fcb947
|
4
|
+
data.tar.gz: 35db62799fbc8c1a2f412de013b879f4a0e1e5c8
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 9204366df87b0482623f88ccc63779df557fb8389f3206e72e3185f4555837f04205498027772bcd4e5dd33ffcf78c8115eaed684c7b849ac860681aa3988d84
|
7
|
+
data.tar.gz: b6fe5c9ffdbf6d5ebe52075f319ac75396bc9eda018f00ee6e7d88fae8fb2db0451a9abc0a772ea36b67c0b43b24602cc5ba49542f5418797e34199bba75b7b6
|
@@ -0,0 +1,25 @@
|
|
1
|
+
module Sluggable
|
2
|
+
|
3
|
+
def self.included(base)
|
4
|
+
base.send(:include, InstanceMethods)
|
5
|
+
base.extend ClassMethods
|
6
|
+
base.class_eval do
|
7
|
+
attach_slug_method
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
module InstanceMethods
|
12
|
+
def generate_slug
|
13
|
+
self.slug = self.sluggable.gsub(' ', '-').downcase
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
module ClassMethods
|
18
|
+
|
19
|
+
def attach_slug_method
|
20
|
+
after_validation :generate_slug
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: gtl-sluggable
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Craig Tran
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2103-09-27 00:00:00.000000000 Z
|
12
|
+
dependencies: []
|
13
|
+
description: A slug creation gem
|
14
|
+
email: cntran@gmail.com
|
15
|
+
executables: []
|
16
|
+
extensions: []
|
17
|
+
extra_rdoc_files: []
|
18
|
+
files:
|
19
|
+
- lib/gtl-sluggable.rb
|
20
|
+
homepage: https://github.com/cntran/gtl-sluggable
|
21
|
+
licenses: []
|
22
|
+
metadata: {}
|
23
|
+
post_install_message:
|
24
|
+
rdoc_options: []
|
25
|
+
require_paths:
|
26
|
+
- lib
|
27
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
28
|
+
requirements:
|
29
|
+
- - '>='
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: '0'
|
32
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - '>='
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '0'
|
37
|
+
requirements: []
|
38
|
+
rubyforge_project:
|
39
|
+
rubygems_version: 2.1.5
|
40
|
+
signing_key:
|
41
|
+
specification_version: 4
|
42
|
+
summary: A slug creation gem
|
43
|
+
test_files: []
|