rackr 0.0.59 → 0.0.60

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/rackr/router.rb +15 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f0717bfcd3ef76fb167d5d9c607677f2519aaefea78e1824e10722d8ab4880af
4
- data.tar.gz: d188f6a38ad01a10263d2d7595b92082efec01a51fd228936453766de782e81f
3
+ metadata.gz: 56bb48ce2a38e77c44d84d7ee7537b144bff11293a6162750d497a392d5a2d6d
4
+ data.tar.gz: 1698e4e88202736612dfcb27d974f414eaf6dbafd62c40433fd33472b638e53e
5
5
  SHA512:
6
- metadata.gz: 1e94b33c2376a0cd03cd2e893f6b9bae62fb9ab84623e807b8a7f4cefd56c81173a3b530eee305faf471687e467e41221584fe74fbf97fd2bb6b535e9cfaf6b6
7
- data.tar.gz: 425c353eb81a4831e0e0bcdf208cc4cb07eadbeaa593e5dca0029e063a17b91cf482528ad0eedde2a5622672ef3c04f4a3214d827ba3a64f79d75fcaa91de46b
6
+ metadata.gz: 68e05e6048d84a6fdf937d6950f15b2d19d9a510e79aaa4a2bb6e375a19fd6b16788172b66e2b3752293eca89218600b319dfd146657e40fd893a619ba7a6083
7
+ data.tar.gz: 2d2cb75c23f21f1d317496e6cf066c74e20f7d13cdf199f754571ba03e77fcd5a72bf253f798fa1dd24a1c434614e8b790652bad8f53591fc374d5043ebfbdbf
data/lib/rackr/router.rb CHANGED
@@ -200,6 +200,12 @@ class Rackr
200
200
  end
201
201
 
202
202
  def match_route(request_method)
203
+ find_instance_in_scope = proc do |request_method, found_scopes|
204
+ @instance_routes[request_method].dig(
205
+ *(found_scopes + [:__instances])
206
+ )&.detect { |route_instance| route_instance.match?(@current_request_path_info) }
207
+ end
208
+
203
209
  last_tail = @splitted_request_path_info.drop(1)
204
210
  found_scopes = []
205
211
 
@@ -217,10 +223,7 @@ class Rackr
217
223
  instance_routes = @instance_routes[request_method].dig(*found_scopes)
218
224
  break
219
225
  elsif scope.start_with?(':')
220
- found_route = @instance_routes[request_method].dig(
221
- *(found_scopes + [:__instances])
222
- )&.detect { |route_instance| route_instance.match?(@current_request_path_info) }
223
-
226
+ found_route = find_instance_in_scope.(request_method, found_scopes)
224
227
  return found_route if found_route
225
228
 
226
229
  found_scopes << scope
@@ -230,9 +233,14 @@ class Rackr
230
233
  end
231
234
  end
232
235
 
233
- @instance_routes[request_method].dig(
234
- *(found_scopes + [:__instances])
235
- )&.detect { |route_instance| route_instance.match?(@current_request_path_info) }
236
+ result_route = find_instance_in_scope.(request_method, found_scopes)
237
+
238
+ if result_route == nil && !found_scopes.empty?
239
+ found_scopes.shift
240
+ result_route = find_instance_in_scope.(request_method, found_scopes)
241
+ end
242
+
243
+ result_route
236
244
  end
237
245
  end
238
246
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rackr
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.59
4
+ version: 0.0.60
5
5
  platform: ruby
6
6
  authors:
7
7
  - Henrique F. Teixeira
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-03-31 00:00:00.000000000 Z
10
+ date: 2025-10-11 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: erubi