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: 50a73110b4c60f539ba49ee24786498c8e4c879c
4
- data.tar.gz: de6931f7d654086fbdbec9763ee8814054d3dc80
3
+ metadata.gz: 5087d066683a876440b5c9a81eef8b303b2f158e
4
+ data.tar.gz: 7ccb094625979cde2ae014bf880304e069bf2b46
5
5
  SHA512:
6
- metadata.gz: 071a03b9ee041e7e36046f4bb5b8b531f71caeaf867ae73f9797621d7085ab6f96e36d552cc03eb4e400c0eff5f53d7aa76df7cb3169ebf0557a4762fdc69c77
7
- data.tar.gz: 1406ed2c917d9d6e03aea3a696cf77dd633c9991a461b97c2357ad822de33b54f80a359f7fb2ae414e3d620d8fb837c43db447327b6d1cb72971c1f81fd956f9
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(/([\w^_](?=[[:upper:]]))|([a-z](?=\d+))/, '\1\2-').
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
@@ -1,3 +1,3 @@
1
1
  module MongoidPermalinkExtension
2
- VERSION = "0.0.5"
2
+ VERSION = "0.0.6"
3
3
  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.5
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-18 00:00:00.000000000 Z
11
+ date: 2015-07-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mongoid