rack-jet_router 1.3.0 → 1.3.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: ffb2322f3ac227a3d07fa95c120d25c3dcb8763f9ea925be7a3a03df11c00ba9
4
- data.tar.gz: 60b292dd4a1307a2fd1cbfcb474746131599fe0ba0ae93768b40f2cf0c9e5fa5
3
+ metadata.gz: 55c3dc8f5747e61e864ee478f7336d755dc022cb4ebc2f75baeae2b2f1059bd8
4
+ data.tar.gz: '085324025413ff2d565f6aad7d8fc1827486d9454772f3c745fb1bd3f3d575f3'
5
5
  SHA512:
6
- metadata.gz: d33fb4622786b549f6681f6a89fd578f631235548b7d67644431483815a71e62d0a438c22b82e2534074c52e704cd68607f02060153ea8477898e13725c3e836
7
- data.tar.gz: 36be6953b2ed04a82f56c97e0c3eaf51022b21546116a0ead5b1a125ff82c746c1297a9c4e153012ca0a922e1a55161a1ea7a534036857d97cd91529aa4118d9
6
+ metadata.gz: 357cfa2babfeb364ff8ca485247eed0f1cb9f7a0c5d7c5ff7c907d593d488bb3e365e198cb6eaf89328b7f85c3e349e273793ade17ee1e94822eed139df90bd0
7
+ data.tar.gz: a6bb2a5d973fa092f356b733ce4ca5f1af335ec53f7d83f9087e0dec271ada489ae80576ba71a4199dd084a6ffc3a25e74e6c29d8e2a1ff0c0e535e2fcf83e8e
data/CHANGES.md CHANGED
@@ -2,6 +2,12 @@ CHANGES
2
2
  =======
3
3
 
4
4
 
5
+ Release 1.3.1 (2023-12-10)
6
+ --------------------------
7
+
8
+ * [bugfix] Fixed to correctly handle suffixed URL path pattern such as `/foo(.:format)`.
9
+
10
+
5
11
  Release 1.3.0 (2023-12-09)
6
12
  --------------------------
7
13
 
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Rack::JetRouter
2
2
 
3
- ($Release: 1.3.0 $)
3
+ ($Release: 1.3.1 $)
4
4
 
5
5
  Rack::JetRouter is crazy-fast router library for Rack application,
6
6
  derived from [Keight.rb](https://github.com/kwatch/keight/tree/ruby).
@@ -2,7 +2,7 @@
2
2
  # frozen_string_literal: true
3
3
 
4
4
  ###
5
- ### $Release: 1.3.0 $
5
+ ### $Release: 1.3.1 $
6
6
  ### $Copyright: copyright(c) 2015 kwatch@gmail.com $
7
7
  ### $License: MIT License $
8
8
  ###
@@ -81,7 +81,7 @@ module Rack
81
81
  ##
82
82
  class JetRouter
83
83
 
84
- RELEASE = '$Release: 1.3.0 $'.split()[1]
84
+ RELEASE = '$Release: 1.3.1 $'.split()[1]
85
85
 
86
86
  #; [!haggu] contains available request methods.
87
87
  REQUEST_METHODS = %w[GET POST PUT DELETE PATCH HEAD OPTIONS TRACE LINK UNLINK] \
@@ -536,10 +536,12 @@ module Rack
536
536
  end
537
537
 
538
538
  def _range_of_urlpath_param(urlpath_pattern) # ex: '/books/:id/edit'
539
+ #; [!93itq] returns nil if urlpath pattern includes optional parameters.
540
+ return nil if urlpath_pattern =~ /\(/
539
541
  #; [!syrdh] returns Range object when urlpath_pattern contains just one param.
540
542
  #; [!skh4z] returns nil when urlpath_pattern contains more than two params.
541
543
  #; [!acj5b] returns nil when urlpath_pattern contains no params.
542
- rexp = /:\w+|\(.*?\)/
544
+ rexp = /:\w+/
543
545
  arr = urlpath_pattern.split(rexp, -1) # ex: ['/books/', '/edit']
544
546
  return nil unless arr.length == 2
545
547
  return (arr[0].length .. -(arr[1].length+1)) # ex: 7..-6 (Range object)
@@ -2,7 +2,7 @@
2
2
 
3
3
  Gem::Specification.new do |spec|
4
4
  spec.name = "rack-jet_router"
5
- spec.version = "$Release: 1.3.0 $".split()[1]
5
+ spec.version = "$Release: 1.3.1 $".split()[1]
6
6
  spec.author = "kwatch"
7
7
  spec.email = "kwatch@gmail.com"
8
8
  spec.platform = Gem::Platform::RUBY
data/test/builder_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.3.0 $
4
+ ### $Release: 1.3.1 $
5
5
  ### $Copyright: copyright(c) 2015 kwatch@gmail.com $
6
6
  ### $License: MIT License $
7
7
  ###
@@ -109,7 +109,7 @@ Oktest.scope do
109
109
  "/api/books" => {
110
110
  :"(?:\\.[^./?]+)?" => {
111
111
  nil => [%r`\A/api/books(?:\.(#{id}))?\z`,
112
- ["format"], {"GET"=>book_list_api}, (10..-1)]},
112
+ ["format"], {"GET"=>book_list_api}, nil]},
113
113
  "/" => {
114
114
  :"[^./?]+" => {
115
115
  :"(?:\\.[^./?]+)?" => {
@@ -598,6 +598,13 @@ Oktest.scope do
598
598
 
599
599
  topic '#range_of_urlpath_param()' do
600
600
 
601
+ spec "[!93itq] returns nil if urlpath pattern includes optional parameters." do
602
+ @builder.instance_exec(self) do |_|
603
+ r1 = _range_of_urlpath_param('/books(.:format)')
604
+ _.ok {r1} == nil
605
+ end
606
+ end
607
+
601
608
  spec "[!syrdh] returns Range object when urlpath_pattern contains just one param." do
602
609
  @builder.instance_exec(self) do |_|
603
610
  r1 = _range_of_urlpath_param('/books/:id')
data/test/router_test.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  # -*- coding: utf-8 -*-
2
2
 
3
3
  ###
4
- ### $Release: 1.3.0 $
4
+ ### $Release: 1.3.1 $
5
5
  ### $Copyright: copyright(c) 2015 kwatch@gmail.com $
6
6
  ### $License: MIT License $
7
7
  ###
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rack-jet_router
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.0
4
+ version: 1.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - kwatch