mongoid_permalink_extension 0.0.5 → 0.0.6
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5087d066683a876440b5c9a81eef8b303b2f158e
|
4
|
+
data.tar.gz: 7ccb094625979cde2ae014bf880304e069bf2b46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9ba2b1d9e0c670a6658284ba556bc178ab4c707117bb12073598c6478610e3e309db8ea1da638cf6c0484550b5c4dd8fe9d4121bb16972f11af35cb0512f1afb
|
7
|
+
data.tar.gz: b9cf4e4aae1281d62a306ed5212b682bc43a2b183b67604d5724dd7fec15c3b5f5960200e2e56e8136ffa1045aa70604bd4e0b7f8c2c14a87d6431a90c5711ea
|
@@ -14,11 +14,12 @@ module MongoidPermalinkExtension
|
|
14
14
|
def mongoize value
|
15
15
|
return if value.nil?
|
16
16
|
value.to_s.
|
17
|
-
gsub(/([
|
17
|
+
gsub(/([^[:upper:]](?=[[:upper:]]))|([a-z](?=\d+))/, '\1\2-').
|
18
18
|
gsub(/\//, '-').
|
19
19
|
gsub(/[-–—]+/, '-').
|
20
20
|
gsub(/[^\p{Alnum} -]/, '').
|
21
21
|
gsub(/\s+/, '-').
|
22
|
+
gsub(/[-]+/, '-').
|
22
23
|
gsub(/\b\w/){ $&.upcase }.
|
23
24
|
to_ascii
|
24
25
|
end
|
@@ -47,6 +47,10 @@ describe MongoidPermalinkExtension::Permalink do
|
|
47
47
|
it 'adds spaces to camel case' do
|
48
48
|
MongoidPermalinkExtension::Permalink.mongoize("CamelCase").must_equal 'Camel-Case'
|
49
49
|
end
|
50
|
+
it 'preserves ABC' do
|
51
|
+
MongoidPermalinkExtension::Permalink.mongoize("ABC Demo").must_equal 'ABC-Demo'
|
52
|
+
# MongoidPermalinkExtension::Permalink.mongoize("ABCDeMo").must_equal 'ABC-De-Mo'
|
53
|
+
end
|
50
54
|
it 'preserves dashes as separators' do
|
51
55
|
MongoidPermalinkExtension::Permalink.mongoize("Camel-Case").must_equal 'Camel-Case'
|
52
56
|
MongoidPermalinkExtension::Permalink.mongoize("Camel--Case").must_equal 'Camel-Case'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mongoid_permalink_extension
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tomas Celizna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07-
|
11
|
+
date: 2015-07-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mongoid
|