ts_routes 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ts_routes/generator.rb +11 -5
- data/lib/ts_routes/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0c6d751ca71ca6df642d568421ad9890985e3630
|
4
|
+
data.tar.gz: 32eac32e26dfa6bb697a03e076a615c7e4c4d502
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7c15b27aa28d02dcf9039523ff8a7614f0774f34c60eec31f2075794987142bdc51619b30d920ac100ef474ce7a4153e1d5c6a708fb2fde5f6fa6a64314e2aae
|
7
|
+
data.tar.gz: 4350847473b664df39f22b15a9ec1fb3bf4cd1d2a0910ed1eba8bbc6330b51ff30e2f52d6f8670d98c37671c026e09f3853275224cae8efdf6f21a68344a90a0
|
data/lib/ts_routes/generator.rb
CHANGED
@@ -124,21 +124,27 @@ module TsRoutes
|
|
124
124
|
end
|
125
125
|
end
|
126
126
|
|
127
|
+
# @param [ActionDispatch::Journey::Route] route
|
128
|
+
# @param [ActionDispatch::Journey::Nodes::Node] spec
|
129
|
+
# @param [ActionDispatch::Journey::Route] parent_route
|
127
130
|
# @return [String]
|
128
131
|
def serialize_spec(route, spec, parent_route = nil)
|
129
132
|
case spec.type
|
130
133
|
when :CAT
|
131
134
|
"#{serialize(route, spec.left, parent_route)} + #{serialize(route, spec.right, parent_route)}"
|
132
|
-
when :GROUP
|
133
|
-
|
134
|
-
|
135
|
-
|
135
|
+
when :GROUP # to declare optional parts
|
136
|
+
if (symbol = spec.left.find(&:symbol?))
|
137
|
+
name_expr = serialize(route, spec.left, parent_route)
|
138
|
+
%{($hasPresentOwnProperty(options, #{symbol.name.to_json}) ? #{name_expr} : "")}
|
139
|
+
else
|
140
|
+
serialize(route, spec.left, parent_route)
|
141
|
+
end
|
136
142
|
when :SYMBOL
|
137
143
|
name = spec.name
|
138
144
|
route.required_parts.include?(name.to_sym) ? name : "(options as any).#{name}"
|
139
145
|
when :STAR
|
140
146
|
name = spec.left.left.sub(/^\*/, '')
|
141
|
-
%{#{name}.map((part) =>
|
147
|
+
%{#{name}.map((part) => $encode(part)).join("/")}
|
142
148
|
when :LITERAL, :SLASH, :DOT
|
143
149
|
serialize(route, spec.left, parent_route)
|
144
150
|
else
|
data/lib/ts_routes/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ts_routes
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FUJI Goro (gfx)
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-06-
|
11
|
+
date: 2017-06-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|