friendly_routes 0.3.2 → 0.3.3
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: 20f66faa1c0ee03ba5ee4d409c3533c233fce5a6
|
4
|
+
data.tar.gz: 86d56ad4c80db6eaefc1b72ebaabc543ac61f74e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 587782afc11016d44dd17f9ed2b54e19e1f0c84ec99053ef6314473f1464460a5cfdba97f2c5839581f9815e4a0e26fcbe044e4e3e9ce010988289fba9497918
|
7
|
+
data.tar.gz: 45e249b6bd390058e8d3be82fe1b716c428ed064709554af10055b99a18819ee930841ee3d2d349e95d09a6c11f6b65635019b4d615f15e450bf93b03b554eb4
|
@@ -7,21 +7,33 @@ module FriendlyRoutes
|
|
7
7
|
@prefix = prefix
|
8
8
|
end
|
9
9
|
|
10
|
+
def to_s
|
11
|
+
mapped(true).join('/')
|
12
|
+
end
|
13
|
+
|
10
14
|
def call
|
11
|
-
mapped
|
15
|
+
mapped(false)
|
12
16
|
end
|
13
17
|
|
14
18
|
private
|
15
19
|
|
16
|
-
def mapped
|
20
|
+
def mapped(keys = true)
|
17
21
|
@params.map do |param|
|
18
22
|
if param.is_a?(FriendlyRoutes::Params::Base)
|
19
|
-
|
20
|
-
param.optional? ? "(:#{name})" : ":#{name}"
|
23
|
+
param_name(param, keys)
|
21
24
|
else
|
22
25
|
param
|
23
26
|
end
|
24
27
|
end
|
25
28
|
end
|
29
|
+
|
30
|
+
def param_name(param, key = true)
|
31
|
+
name = PrefixedParam.new(param.name, @prefix).call
|
32
|
+
if key
|
33
|
+
param.optional? ? "(:#{name})" : ":#{name}"
|
34
|
+
else
|
35
|
+
name
|
36
|
+
end
|
37
|
+
end
|
26
38
|
end
|
27
39
|
end
|