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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 40d4f77515d6cb1a85d29898e8f77b82ba476cb3
4
- data.tar.gz: bc5e0ce0dfeb56a65a9588c09bbbbc6eda881c65
3
+ metadata.gz: e2c7a2fe8d9d4034661eb4144f5059c7e2f3e94a
4
+ data.tar.gz: 9d1a23c6df4ee55dd766bfa56f77bf0c4fde6aed
5
5
  SHA512:
6
- metadata.gz: bba96c99deed6b3ba7f2725570eb910462f1f433f5623492c853bc0500c4a2cd003566c7ea0d5b47014863dcd8c441d777e0ba0e9d4a7d9f9703ac502af7d313
7
- data.tar.gz: 76796bf65bd0b1a6c67fb292af783780538b8f9e331588b7b86562f1dfdc3e54cbb9be290b702d96f0ae8a1c3611849e7ab8a6d48219f1e7ad8eb2aa68b5b7df
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
@@ -3,5 +3,6 @@ set -euo pipefail
3
3
  IFS=$'\n\t'
4
4
  set -vx
5
5
 
6
+ gem install bundler
6
7
  bundle check || bundle install
7
8
  npm install
@@ -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 [Rails::Application]
14
- attr_reader :application
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(application: Rails.application,
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
- @application = application
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
@@ -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 as ScalarType[]) {
20
+ for (const v of value) {
21
21
  q.push(encodeURIComponent(key + "[]") + "=" + encodeURIComponent("" + v));
22
22
  }
23
23
  } else if(value !== null && value !== undefined) {
@@ -1,3 +1,3 @@
1
1
  module TsRoutes
2
- VERSION = "0.3.0"
2
+ VERSION = "0.4.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.3.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-16 00:00:00.000000000 Z
11
+ date: 2017-06-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties