ts_routes 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/bin/setup +1 -0
- data/lib/ts_routes/generator.rb +4 -9
- data/lib/ts_routes/runtime.ts +1 -1
- 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: e2c7a2fe8d9d4034661eb4144f5059c7e2f3e94a
|
4
|
+
data.tar.gz: 9d1a23c6df4ee55dd766bfa56f77bf0c4fde6aed
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec7070eb44b1d0097ae313eb38033273d0761b087c62bed419c9438ae64bfe366dd04d6c503ec23ff341a0bc64305cff635945f84bdc5ebcf8610d6566383db4
|
7
|
+
data.tar.gz: d27ea016116dce35925e0707ecfb83cd35c475ce8ee4b966e07298991ec2e1fca99fdfa421fb4e13b5cb19def4578a83cf3dddd7def48b6085fb71b3f3de3a68
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
# TsRoutes for Rails [![Build Status](https://travis-ci.org/bitjourney/ts_routes-rails.svg?branch=master)](https://travis-ci.org/bitjourney/ts_routes-rails)
|
1
|
+
# TsRoutes for Rails [![Gem Version](https://badge.fury.io/rb/ts_routes.svg)](https://badge.fury.io/rb/ts_routes) [![Build Status](https://travis-ci.org/bitjourney/ts_routes-rails.svg?branch=master)](https://travis-ci.org/bitjourney/ts_routes-rails)
|
2
2
|
|
3
3
|
This gem generates Rails URL helpers in TypeScript, inspired by [js-routes](https://github.com/railsware/js-routes).
|
4
4
|
|
data/bin/setup
CHANGED
data/lib/ts_routes/generator.rb
CHANGED
@@ -10,8 +10,8 @@ module TsRoutes
|
|
10
10
|
|
11
11
|
DEFAULT_FILE_HEADER = "/* tslint:disable:max-line-length variable-name whitespace */"
|
12
12
|
|
13
|
-
# @return [
|
14
|
-
attr_reader :
|
13
|
+
# @return [ActionDispatch::Routing::RouteSet]
|
14
|
+
attr_reader :routes
|
15
15
|
|
16
16
|
# @return [Boolean] default to true
|
17
17
|
attr_reader :camel_case
|
@@ -28,14 +28,14 @@ module TsRoutes
|
|
28
28
|
# @return [String]
|
29
29
|
attr_reader :header
|
30
30
|
|
31
|
-
def initialize(
|
31
|
+
def initialize(routes: Rails.application.routes,
|
32
32
|
camel_case: true,
|
33
33
|
route_suffix: 'path',
|
34
34
|
include: nil,
|
35
35
|
exclude: nil,
|
36
36
|
header: DEFAULT_FILE_HEADER
|
37
37
|
)
|
38
|
-
@
|
38
|
+
@routes = routes
|
39
39
|
@camel_case = camel_case
|
40
40
|
@route_suffix = route_suffix
|
41
41
|
@include = include
|
@@ -43,11 +43,6 @@ module TsRoutes
|
|
43
43
|
@header = header
|
44
44
|
end
|
45
45
|
|
46
|
-
# @return [ActionDispatch::Routing::RouteSet]
|
47
|
-
def routes
|
48
|
-
application.routes
|
49
|
-
end
|
50
|
-
|
51
46
|
# @return [ActionDispatch::Routing::RouteSet::NamedRouteCollection]
|
52
47
|
def named_routes
|
53
48
|
routes.named_routes
|
data/lib/ts_routes/runtime.ts
CHANGED
@@ -17,7 +17,7 @@ function $buildOptions(options: any, names: string[]): string {
|
|
17
17
|
if (key === "anchor") {
|
18
18
|
anchor = "#" + encodeURIComponent("" + value);
|
19
19
|
} else if (Array.isArray(value)) {
|
20
|
-
for (const v of value
|
20
|
+
for (const v of value) {
|
21
21
|
q.push(encodeURIComponent(key + "[]") + "=" + encodeURIComponent("" + v));
|
22
22
|
}
|
23
23
|
} else if(value !== null && value !== undefined) {
|
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.4.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-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: railties
|