uri-builder 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +2 -1
- data/lib/uri/builder/version.rb +1 -1
- data/lib/uri/builder.rb +19 -2
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 24c6ebf9a70ca63eb01b8aea923ecacfa1222bc70cf8bd0dc64be4bd57ef40d0
|
4
|
+
data.tar.gz: c09a538e4482ce1639e20670be158a61849e9a013f1b8a06586d2f7916541c0a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 75d5605ac76a572fa356a9839eda7a989ceede7d67fc0897493a1136413c74b3217eed0711124022b2344aa869b5d6a6350b2bc3d17766de71755b92c799a64e
|
7
|
+
data.tar.gz: da74d731e4ac46e320932abcf3572c3a2b5b7ba0ab01c648e44c3b76f564c42df3d8be8fb557b8614e0fc1c5fd60cb809afcab4709c31277a72efb5a6c7a0f9d
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
uri-builder (0.1.
|
4
|
+
uri-builder (0.1.9)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -26,6 +26,7 @@ PLATFORMS
|
|
26
26
|
arm64-darwin-21
|
27
27
|
arm64-darwin-22
|
28
28
|
arm64-darwin-23
|
29
|
+
arm64-darwin-24
|
29
30
|
x86_64-darwin-20
|
30
31
|
|
31
32
|
DEPENDENCIES
|
data/lib/uri/builder/version.rb
CHANGED
data/lib/uri/builder.rb
CHANGED
@@ -39,8 +39,8 @@ module URI
|
|
39
39
|
|
40
40
|
def query(value)
|
41
41
|
value = case value
|
42
|
-
when Hash
|
43
|
-
|
42
|
+
when Hash, Array
|
43
|
+
build_query value
|
44
44
|
else
|
45
45
|
value
|
46
46
|
end
|
@@ -66,6 +66,23 @@ module URI
|
|
66
66
|
@uri.send "#{property}=", value
|
67
67
|
self
|
68
68
|
end
|
69
|
+
|
70
|
+
def build_query(params, prefix = nil)
|
71
|
+
case params
|
72
|
+
when Hash
|
73
|
+
params.map { |key, value|
|
74
|
+
new_prefix = prefix ? "#{prefix}[#{key}]" : key.to_s
|
75
|
+
build_query(value, new_prefix)
|
76
|
+
}.reject(&:empty?).join('&')
|
77
|
+
when Array
|
78
|
+
params.map.with_index { |value, _index|
|
79
|
+
new_prefix = "#{prefix}[]"
|
80
|
+
build_query(value, new_prefix)
|
81
|
+
}.reject(&:empty?).join('&')
|
82
|
+
else
|
83
|
+
"#{prefix}=#{URI.encode_www_form_component(params.to_s)}"
|
84
|
+
end
|
85
|
+
end
|
69
86
|
end
|
70
87
|
end
|
71
88
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: uri-builder
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build URIs via chains
|
14
14
|
email:
|
@@ -51,7 +51,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
51
51
|
- !ruby/object:Gem::Version
|
52
52
|
version: '0'
|
53
53
|
requirements: []
|
54
|
-
rubygems_version: 3.5.
|
54
|
+
rubygems_version: 3.5.16
|
55
55
|
signing_key:
|
56
56
|
specification_version: 4
|
57
57
|
summary: Build URIs via chains
|