slugize 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- data/.rspec +1 -0
- data/README.md +21 -0
- data/lib/slugize.rb +2 -2
- data/lib/slugize/version.rb +1 -1
- data/spec/slugize_spec.rb +18 -0
- data/spec/spec_helper.rb +1 -0
- metadata +66 -42
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/README.md
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
## <a name="Examples"></a>Examples
|
2
|
+
In your Ruby application, you can use following:
|
3
|
+
|
4
|
+
'Kamil Wdowicz'.slugize
|
5
|
+
'zażółć gęślą jąźń'.slugize
|
6
|
+
'zażółć gęślą jąźń'.slugize('_')
|
7
|
+
|
8
|
+
This will produce:
|
9
|
+
|
10
|
+
'kamil-wdowicz'
|
11
|
+
'zazolc-gesla-jazn'
|
12
|
+
'zazolc_gesla_jazn'
|
13
|
+
|
14
|
+
## <a name="installation"></a>Installation
|
15
|
+
In your `Gemfile`, add the following:
|
16
|
+
|
17
|
+
gem 'slugize'
|
18
|
+
|
19
|
+
Run:
|
20
|
+
|
21
|
+
$ bundle install
|
data/lib/slugize.rb
CHANGED
data/lib/slugize/version.rb
CHANGED
@@ -0,0 +1,18 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require 'spec_helper'
|
3
|
+
describe String do
|
4
|
+
describe ".slugize" do
|
5
|
+
it "removes spaces" do
|
6
|
+
"this is example".slugize.should eq("this-is-example")
|
7
|
+
end
|
8
|
+
it "use custom separator" do
|
9
|
+
"this is example".slugize('_').should eq("this_is_example")
|
10
|
+
end
|
11
|
+
it "removes nonascii characters" do
|
12
|
+
"aīīa".slugize.should eq("aa")
|
13
|
+
end
|
14
|
+
it "but replace polish characters" do
|
15
|
+
"zażółć gęślą jąźń".slugize.should eq("zazolc-gesla-jazn")
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require 'slugize'
|
metadata
CHANGED
@@ -1,75 +1,99 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: slugize
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
prerelease: false
|
5
|
+
segments:
|
6
|
+
- 0
|
7
|
+
- 0
|
8
|
+
- 3
|
9
|
+
version: 0.0.3
|
6
10
|
platform: ruby
|
7
|
-
authors:
|
11
|
+
authors:
|
8
12
|
- Kamil Wdowicz
|
9
|
-
autorequire:
|
13
|
+
autorequire:
|
10
14
|
bindir: bin
|
11
15
|
cert_chain: []
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
+
|
17
|
+
date: 2012-05-08 00:00:00 +02:00
|
18
|
+
default_executable:
|
19
|
+
dependencies:
|
20
|
+
- !ruby/object:Gem::Dependency
|
16
21
|
name: rspec
|
17
|
-
|
22
|
+
prerelease: false
|
23
|
+
requirement: &id001 !ruby/object:Gem::Requirement
|
18
24
|
none: false
|
19
|
-
requirements:
|
20
|
-
- -
|
21
|
-
- !ruby/object:Gem::Version
|
22
|
-
|
25
|
+
requirements:
|
26
|
+
- - ">="
|
27
|
+
- !ruby/object:Gem::Version
|
28
|
+
segments:
|
29
|
+
- 0
|
30
|
+
version: "0"
|
23
31
|
type: :development
|
24
|
-
|
25
|
-
|
26
|
-
- !ruby/object:Gem::Dependency
|
32
|
+
version_requirements: *id001
|
33
|
+
- !ruby/object:Gem::Dependency
|
27
34
|
name: rake
|
28
|
-
|
35
|
+
prerelease: false
|
36
|
+
requirement: &id002 !ruby/object:Gem::Requirement
|
29
37
|
none: false
|
30
|
-
requirements:
|
31
|
-
- -
|
32
|
-
- !ruby/object:Gem::Version
|
33
|
-
|
38
|
+
requirements:
|
39
|
+
- - ">="
|
40
|
+
- !ruby/object:Gem::Version
|
41
|
+
segments:
|
42
|
+
- 0
|
43
|
+
version: "0"
|
34
44
|
type: :development
|
35
|
-
|
36
|
-
version_requirements: *3902420
|
45
|
+
version_requirements: *id002
|
37
46
|
description: Adds slugize method to Ruby String
|
38
|
-
email:
|
47
|
+
email:
|
39
48
|
- lolmamut@gmail.com
|
40
49
|
executables: []
|
50
|
+
|
41
51
|
extensions: []
|
52
|
+
|
42
53
|
extra_rdoc_files: []
|
43
|
-
|
54
|
+
|
55
|
+
files:
|
44
56
|
- .gitignore
|
57
|
+
- .rspec
|
45
58
|
- Gemfile
|
59
|
+
- README.md
|
46
60
|
- Rakefile
|
47
61
|
- lib/slugize.rb
|
48
62
|
- lib/slugize/version.rb
|
49
63
|
- slugize.gemspec
|
64
|
+
- spec/slugize_spec.rb
|
65
|
+
- spec/spec_helper.rb
|
50
66
|
has_rdoc: true
|
51
|
-
homepage:
|
67
|
+
homepage: ""
|
52
68
|
licenses: []
|
53
|
-
|
69
|
+
|
70
|
+
post_install_message:
|
54
71
|
rdoc_options: []
|
55
|
-
|
72
|
+
|
73
|
+
require_paths:
|
56
74
|
- lib
|
57
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
75
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
58
76
|
none: false
|
59
|
-
requirements:
|
60
|
-
- -
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
|
63
|
-
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
segments:
|
81
|
+
- 0
|
82
|
+
version: "0"
|
83
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
64
84
|
none: false
|
65
|
-
requirements:
|
66
|
-
- -
|
67
|
-
- !ruby/object:Gem::Version
|
68
|
-
|
85
|
+
requirements:
|
86
|
+
- - ">="
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
segments:
|
89
|
+
- 0
|
90
|
+
version: "0"
|
69
91
|
requirements: []
|
92
|
+
|
70
93
|
rubyforge_project: slugize
|
71
|
-
rubygems_version: 1.
|
72
|
-
signing_key:
|
94
|
+
rubygems_version: 1.3.7
|
95
|
+
signing_key:
|
73
96
|
specification_version: 3
|
74
97
|
summary: Adds slugize method to Ruby String
|
75
98
|
test_files: []
|
99
|
+
|