clearwater 1.0.0.beta2 → 1.0.0.beta3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: cb24eb4af46552525a7cb79d00efd56b4c90b083
4
- data.tar.gz: b7e10a82f1cca42eec4cf054cb404cb964c6a351
3
+ metadata.gz: 0f3b1ded6dac98af01bec9bdaedc42f78ddafc4e
4
+ data.tar.gz: 284c6c9a0481dd5e6991709422bb879ede4f9586
5
5
  SHA512:
6
- metadata.gz: 8c94a24f020fb882c18425ef7b79b1799f2a4c8fc31b00bba21e0c776083cef8524fee2bde5f784941eb22cec37cb0b3a61bae7f065bc80d315021186a4dd486
7
- data.tar.gz: a216d0c5987d376691857ad8c38f7cff6475f301471b54bce1ae56d627e9cd9d62efd915fef9a5ba2d3968406e391afdb09884890f7aeaad222152cf0ea9a844
6
+ metadata.gz: be833a327efea9000a92d936c1e78b33843e8f0222290d77175d797a87e2646e22c362e2960f27068d7bbd111ccd13c8cee5cf25c7e40a4ae07e68c85bad0036
7
+ data.tar.gz: 5ac50a1cca2683d81683dea330b613fa32841e5c1df92ddb98d6ffce400978c171189cf986a868cd870f5d8afadc4c74946da0538fdc1c4b4534c543e0d24153
@@ -1,3 +1,3 @@
1
1
  module Clearwater
2
- VERSION = "1.0.0.beta2"
2
+ VERSION = "1.0.0.beta3"
3
3
  end
@@ -25,7 +25,10 @@ module Clearwater
25
25
  end
26
26
 
27
27
  def canonical_path_for_path path
28
- routes_for_path(path).map { |r| "/#{r.key}" }.join
28
+ routes_for_path(path).map { |r|
29
+ namespace = r.namespace
30
+ "#{"/#{namespace}" if namespace}/#{r.key}"
31
+ }.join
29
32
  end
30
33
 
31
34
  def targets_for_path path
@@ -49,6 +52,10 @@ module Clearwater
49
52
  def canonical_path
50
53
  end
51
54
 
55
+ def nested_routes
56
+ @routes
57
+ end
58
+
52
59
  def current_path
53
60
  location.path
54
61
  end
@@ -29,6 +29,10 @@ module Clearwater
29
29
  end
30
30
  end
31
31
 
32
+ def namespace
33
+ parent.nested_routes.namespace
34
+ end
35
+
32
36
  private
33
37
 
34
38
  def param_key?
@@ -28,8 +28,13 @@ module Clearwater
28
28
  @routes << route
29
29
  end
30
30
 
31
- def namespace path
32
- @namespace = path
31
+ def namespace *args
32
+ path = args.first
33
+ if path
34
+ @namespace = path
35
+ end
36
+
37
+ @namespace
33
38
  end
34
39
 
35
40
  def [] route_names
@@ -48,5 +48,18 @@ module Clearwater
48
48
  it 'gets the params from the path' do
49
49
  expect(router.params('/articles/123')).to eq({ article_id: '123' })
50
50
  end
51
+
52
+ it 'gets params with a namespace' do
53
+ component = routed_component
54
+ router = Router.new do
55
+ namespace 'clearwater'
56
+
57
+ route 'articles' => component do
58
+ route ':article_id' => component
59
+ end
60
+ end
61
+
62
+ expect(router.params('/clearwater/articles/123')).to eq({ article_id: '123' })
63
+ end
51
64
  end
52
65
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: clearwater
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: 2016-02-14 00:00:00.000000000 Z
11
+ date: 2016-02-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: opal