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 +4 -4
- data/CHANGES.md +6 -0
- data/README.md +1 -1
- data/lib/rack/jet_router.rb +5 -3
- data/rack-jet_router.gemspec +1 -1
- data/test/builder_test.rb +9 -2
- data/test/router_test.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 55c3dc8f5747e61e864ee478f7336d755dc022cb4ebc2f75baeae2b2f1059bd8
|
4
|
+
data.tar.gz: '085324025413ff2d565f6aad7d8fc1827486d9454772f3c745fb1bd3f3d575f3'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 357cfa2babfeb364ff8ca485247eed0f1cb9f7a0c5d7c5ff7c907d593d488bb3e365e198cb6eaf89328b7f85c3e349e273793ade17ee1e94822eed139df90bd0
|
7
|
+
data.tar.gz: a6bb2a5d973fa092f356b733ce4ca5f1af335ec53f7d83f9087e0dec271ada489ae80576ba71a4199dd084a6ffc3a25e74e6c29d8e2a1ff0c0e535e2fcf83e8e
|
data/CHANGES.md
CHANGED
data/README.md
CHANGED
data/lib/rack/jet_router.rb
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
# frozen_string_literal: true
|
3
3
|
|
4
4
|
###
|
5
|
-
### $Release: 1.3.
|
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.
|
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)
|
data/rack-jet_router.gemspec
CHANGED
data/test/builder_test.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# -*- coding: utf-8 -*-
|
2
2
|
|
3
3
|
###
|
4
|
-
### $Release: 1.3.
|
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},
|
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