ts_routes 0.1.0 → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ab317b18c9a7ffbcb0e1f3324fb6555174e6e8d1
4
- data.tar.gz: c13f90230602915440fd2f2614c8d2fce67332ee
3
+ metadata.gz: 8cd843a2d83376476d5c53066593deb4b6c7dd6b
4
+ data.tar.gz: c30a43ec163cbfe6ae165f78d8bdeaf5e27a6ee3
5
5
  SHA512:
6
- metadata.gz: 4c871c035d98d4c73a7da1657a310c0fb72fa9674eefc12b840c6053e2e6c3a8b3258ed65fb9ab2e43b2dccc6cb91688409f20cd924b6a3fe82764be5f7deb4f
7
- data.tar.gz: 21c8012208d4d2452f0e2a9415fc349cf489a20e4a451067f22bcdf10aab88c1ee35fbb14cc1ee35593c1a8b3efe49b205a3dd693d507a3934a4f4e92f6d0426
6
+ metadata.gz: 555a4ffe0711f89708939e28eb3962bf31244b52c86901bb20f3b17b92f9ec7e5455357533251a23b69223b6bfeb9f64a7e32df318f42c823a483d3d0ff740e5
7
+ data.tar.gz: 2dd2cbb2b26a5c7f141d88e1d8841fe55b5d7875f7c2124c4a3dbfc0d920bd33df2d1ce77582623b65441e636d5cfb793f142f95e647622e83921e1e9652549e
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  This gem generates Rails URL helpers in TypeScript, inspired by [js-routes](https://github.com/railsware/js-routes).
4
4
 
5
5
 
6
- ## SYNOPSIS
6
+ ## Usage
7
7
 
8
8
  In your `lib/tasks/ts_routes.rake`:
9
9
 
@@ -35,6 +35,13 @@ console.log(Routes.entriesPath({ page: 1, per: 20 })); // => /entries?page=1&per
35
35
  console.log(Routes.entryPath(1)); // => /entries/1
36
36
  ```
37
37
 
38
+ Generated URL helpers are almost compatible with Rails, but they are more strict:
39
+
40
+ * You must pass required parameters to the helpers as non-named (i.e. normal) arguments
41
+ * i.e. `Routes.entryPath(1)` for `/entries/:id`
42
+ * `Routes.entryPath({ id })` is refused
43
+ * You must pass optional parameters as the last argument
44
+ * i.e. `Routes.entriesPath({ page: 1, per: 2 })`
38
45
 
39
46
  ## Installation
40
47
 
@@ -52,16 +59,6 @@ Or install it yourself as:
52
59
 
53
60
  $ gem install ts_routes
54
61
 
55
- ## Usage
56
-
57
- Generated URL helpers are almost compatible with Rails:
58
-
59
- * You must pass required parameters to the helpers as non-named (i.e. normal) arguments
60
- * i.e. `Routes.entryPath(1)` for `/entries/:id`
61
- * `Routes.entryPath({ id })` is refused
62
- * You must pass optional parameters as the last argument
63
- * i.e. `Routes.entriesPath({ page: 1, per: 2 })`
64
-
65
62
  ## Development
66
63
 
67
64
  After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
@@ -66,7 +66,7 @@ module TsRoutes
66
66
  def mounted_app_routes(route)
67
67
  app = route.app.respond_to?(:app) && route.app.respond_to?(:constraints) ? route.app.app : route.app
68
68
 
69
- if app.respond_to?(:superclass) && app.superclass >= Rails::Engine && !route.path.anchored
69
+ if app.respond_to?(:superclass) && app.superclass <= Rails::Engine && !route.path.anchored
70
70
  app.routes.named_routes.flat_map do |_, engine_route|
71
71
  build_routes_if_match(engine_route, route)
72
72
  end
@@ -1,3 +1,3 @@
1
1
  module TsRoutes
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ts_routes
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - FUJI Goro (gfx)