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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 83884b340a2d1a221f2b76bccb12806c0700de37
4
- data.tar.gz: 469bc903d770a8785026770570dd033dd743de53
3
+ metadata.gz: 0c6d751ca71ca6df642d568421ad9890985e3630
4
+ data.tar.gz: 32eac32e26dfa6bb697a03e076a615c7e4c4d502
5
5
  SHA512:
6
- metadata.gz: edca793080e36504208e99bdc1aa7f67e4098dfa43c9765afb08eba93184d1c0915ec7ce953e0b644da4ad02f13f0c2242b9ba8d0786d5795bab8621805a169e
7
- data.tar.gz: 65126dbef060562c1998a6b78433b0f3a474d1b2a96f050b3fe5da1d2719f3a5d1020507c05b65c83f77f121c7253f89a9d0d7b26f748c58024acf5cdeae2ab5
6
+ metadata.gz: 7c15b27aa28d02dcf9039523ff8a7614f0774f34c60eec31f2075794987142bdc51619b30d920ac100ef474ce7a4153e1d5c6a708fb2fde5f6fa6a64314e2aae
7
+ data.tar.gz: 4350847473b664df39f22b15a9ec1fb3bf4cd1d2a0910ed1eba8bbc6330b51ff30e2f52d6f8670d98c37671c026e09f3853275224cae8efdf6f21a68344a90a0
@@ -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
- name = spec.left.find(&:symbol?).name
134
- name_expr = serialize(route, spec.left, parent_route)
135
- %{($hasPresentOwnProperty(options, #{name.to_json}) ? #{name_expr} : "")}
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) => encodeURIComponent("" + part)).join("/")}
147
+ %{#{name}.map((part) => $encode(part)).join("/")}
142
148
  when :LITERAL, :SLASH, :DOT
143
149
  serialize(route, spec.left, parent_route)
144
150
  else
@@ -1,3 +1,3 @@
1
1
  module TsRoutes
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
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.8.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-22 00:00:00.000000000 Z
11
+ date: 2017-06-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties