perpetuity 1.0.0.beta2 → 1.0.0.beta3

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: 5a1455076e7e95dfb019c9d2dde967df36e40ef5
4
- data.tar.gz: f35c774af07f2890d4f012067694c888b4ad5c1d
3
+ metadata.gz: 7cf95b4e9ae21a8017556d5928b72d0ce4a23e94
4
+ data.tar.gz: 0ac11a4957b4b6a8b3f991b35b726b0f0da1533f
5
5
  SHA512:
6
- metadata.gz: e9cdc1e4fadbc9efeafc7887a42a0ed759472b0439de8519e6ad4d557eb910637dda9b247d0f06643e2dccc59cb4819746de06179dfbdbc01a84b3e9549cd314
7
- data.tar.gz: 4ebd69b7c403320f2748e62dabc6f237c69bc2b21c59b2cf1e0426dbb7068735355e99445ebfedc2ba7527c456c5154c282304bce168273a1a031195ea1dad45
6
+ metadata.gz: 07de997c8ddb238ae077bc8154a58e0d4f7a422c465bf4e98b303ecf6082701e5c1230cb70728b3e37d5124751c3b4ba90d55e44837d61407aac05a9eeb37bfd
7
+ data.tar.gz: 627e785dbb378e4e00e5de44645635f33d600376f19ed562eb906b19e265919a3ea13aaf24221df7a02dfb1fce1617ab12a85c67ff82c7350ac46c2da8e7a825
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Version 1.0.0.beta3
2
+
3
+ - Fix title-case -> snake-case support to convert something like `UserRegistration` to `user_registration`. Previously, it would return `userregistration`.
4
+
1
5
  ## Version 1.0.0.beta2
2
6
 
3
7
  - Allow data source to be configured with a URI. This lets you say `Perpetuity.data_source "postgres://user:password@postgres.example.com:5432/my_database"`, keeping you from having to split up the URI yourself.
@@ -22,7 +22,10 @@ module Perpetuity
22
22
  end
23
23
 
24
24
  def param_key
25
- self.to_s.downcase.gsub('::', '_')
25
+ to_s.gsub('::', '_')
26
+ .gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
27
+ .gsub(/([a-z\d])([A-Z])/,'\1_\2')
28
+ .downcase
26
29
  end
27
30
 
28
31
  def route_key
@@ -1,3 +1,3 @@
1
1
  module Perpetuity
2
- VERSION = "1.0.0.beta2"
2
+ VERSION = "1.0.0.beta3"
3
3
  end
@@ -33,9 +33,16 @@ module Perpetuity
33
33
  klass.model_name.should be == klass
34
34
  end
35
35
 
36
- it 'returns the param_key' do
37
- stub_const 'Foo::Bar', klass
38
- Foo::Bar.param_key.should be == 'foo_bar'
36
+ describe 'param_key' do
37
+ it 'converts :: to _' do
38
+ stub_const 'Foo::Bar', klass
39
+ Foo::Bar.param_key.should be == 'foo_bar'
40
+ end
41
+
42
+ it 'converts title-case to snake-case' do
43
+ stub_const 'UserRegistration', klass
44
+ UserRegistration.param_key.should be == 'user_registration'
45
+ end
39
46
  end
40
47
 
41
48
  it 'returns the route_key' do
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: perpetuity
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.beta2
4
+ version: 1.0.0.beta3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jamie Gaskins
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-30 00:00:00.000000000 Z
11
+ date: 2014-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake