js_rails_routes 0.8.0 → 0.8.1

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
  SHA256:
3
- metadata.gz: a39fd7ffc8b9d7c33679acfc90ac9df033880e9795ab6c3a312c038a8ca22313
4
- data.tar.gz: 30defa0fff6b4a834106f109f9f07e2122c74ed69a6137b64cf0362968dfd50d
3
+ metadata.gz: abaf98e11062f86106203b6b2d68bbf65c83c00e0781122019cc1d0ca20a5fe3
4
+ data.tar.gz: 38cb07f953ea05bdb1a754a76bfc8e8fd2637c778b69eb35a6d39eb6484b5296
5
5
  SHA512:
6
- metadata.gz: 446e25f72d627356b9b592ef2cc368ac5f6d16f02f1b6274f66d11ef35471307df3ab29b16a2a53e2cc383a18054b6ba39ec7d19cf1c5cfd984e4d9c7b424033
7
- data.tar.gz: 12e2923b66465a669d2ab162a56ff041d573c4a7d605ba7e5bc0931ca22fb0b8b3b661263872d833ff623a64cb8bcb1b32cb89725d1a9ef5f34e27a55d49bcfe
6
+ metadata.gz: 8c2c5bff02e8b53f16ec78fa3e818b693786f454c5cf226a13e3c9d67371e69d1e3d5eae538e5c9c52116abf5394902311afe8f5604ffa56e34fe77ba925d930
7
+ data.tar.gz: 10ebd6b90a0bf90b566ed76fa1aeef2ee87612c59c44728917fcc63107075d38c640e21cf450bd4b60d0479973aae407a14cd0112099cf33a134fd2677d2c814
data/CHANGELOG.md CHANGED
@@ -6,6 +6,10 @@ This change log adheres to [keepachangelog.com](http://keepachangelog.com).
6
6
 
7
7
  ## [Unreleased]
8
8
 
9
+ ## [0.8.1] - 2018-08-21
10
+ ### Fixed
11
+ - Camelize `params` keys as `camelize` option
12
+
9
13
  ## [0.8.0] - 2018-08-21
10
14
  ### Added
11
15
  - Support TypeScript
@@ -62,7 +66,8 @@ This change log adheres to [keepachangelog.com](http://keepachangelog.com).
62
66
  ### Added
63
67
  - Implement "js:rails:routes" task
64
68
 
65
- [Unreleased]: https://github.com/yuku-t/js_rails_routes/compare/v0.8.0...HEAD
69
+ [Unreleased]: https://github.com/yuku-t/js_rails_routes/compare/v0.8.1...HEAD
70
+ [0.8.1]: https://github.com/yuku-t/js_rails_routes/compare/v0.8.0...v0.8.1
66
71
  [0.8.0]: https://github.com/yuku-t/js_rails_routes/compare/v0.7.1...v0.8.0
67
72
  [0.7.1]: https://github.com/yuku-t/js_rails_routes/compare/v0.7.0...v0.7.1
68
73
  [0.7.0]: https://github.com/yuku-t/js_rails_routes/compare/v0.6.0...v0.7.0
@@ -46,11 +46,9 @@ module JSRailsRoutes
46
46
  destructured_path = route_path.dup
47
47
  keys = []
48
48
  while destructured_path =~ JSRailsRoutes::PARAM_REGEXP
49
- keys.push("'#{Regexp.last_match(1)}'")
50
- destructured_path.sub!(
51
- JSRailsRoutes::PARAM_REGEXP,
52
- "' + params.#{Regexp.last_match(1)} + '#{Regexp.last_match(2)}"
53
- )
49
+ key = camelize(Regexp.last_match(1))
50
+ keys.push("'#{key}'")
51
+ destructured_path.sub!(JSRailsRoutes::PARAM_REGEXP, "' + params.#{key} + '#{Regexp.last_match(2)}")
54
52
  end
55
53
  [destructured_path, keys]
56
54
  end
@@ -61,6 +59,17 @@ module JSRailsRoutes
61
59
  url_helper_name = route_name + '_path'
62
60
  config.camelize.nil? ? url_helper_name : url_helper_name.camelize(config.camelize)
63
61
  end
62
+
63
+ # @param name [String]
64
+ # @return [String]
65
+ def camelize(name)
66
+ config.camelize ? name.camelize(config.camelize) : name
67
+ end
68
+
69
+ # @return [JSRailsRoutes::Configuration]
70
+ def config
71
+ JSRailsRoutes.config
72
+ end
64
73
  end
65
74
  end
66
75
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module JSRailsRoutes
4
- VERSION = '0.8.0'
4
+ VERSION = '0.8.1'
5
5
  end
@@ -77,8 +77,8 @@ RSpec.describe JSRailsRoutes::Language::JavaScript do
77
77
  #{described_class::PROCESS_FUNC}
78
78
  export function ArticlesPath(params) { return process('/articles', params, []); }
79
79
  export function NewArticlePath(params) { return process('/articles/new', params, []); }
80
- export function EditArticlePath(params) { return process('/articles/' + params.id + '/edit', params, ['id']); }
81
- export function ArticlePath(params) { return process('/articles/' + params.id + '', params, ['id']); }
80
+ export function EditArticlePath(params) { return process('/articles/' + params.Id + '/edit', params, ['Id']); }
81
+ export function ArticlePath(params) { return process('/articles/' + params.Id + '', params, ['Id']); }
82
82
  JAVASCRIPT
83
83
  end
84
84
  end
@@ -78,8 +78,8 @@ RSpec.describe JSRailsRoutes::Language::TypeScript do
78
78
  #{described_class::PROCESS_FUNC}
79
79
  export function ArticlesPath(params: Params) { return process('/articles', params, []); }
80
80
  export function NewArticlePath(params: Params) { return process('/articles/new', params, []); }
81
- export function EditArticlePath(params: Params) { return process('/articles/' + params.id + '/edit', params, ['id']); }
82
- export function ArticlePath(params: Params) { return process('/articles/' + params.id + '', params, ['id']); }
81
+ export function EditArticlePath(params: Params) { return process('/articles/' + params.Id + '/edit', params, ['Id']); }
82
+ export function ArticlePath(params: Params) { return process('/articles/' + params.Id + '', params, ['Id']); }
83
83
  TYPESCRIPT
84
84
  end
85
85
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: js_rails_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuku Takahashi