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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1c38b14bcda23d719520fbff41c9b080c9a7ee895391da9cba6f6febece54e0b
4
- data.tar.gz: 7c95d5b847ffa2d43af8927f5a49962d0e5c5b322fa92676d7e41bd2d571086b
3
+ metadata.gz: 24c6ebf9a70ca63eb01b8aea923ecacfa1222bc70cf8bd0dc64be4bd57ef40d0
4
+ data.tar.gz: c09a538e4482ce1639e20670be158a61849e9a013f1b8a06586d2f7916541c0a
5
5
  SHA512:
6
- metadata.gz: 7e109a8c2fb79b0a512377e878da1f9b9c4c8b7475848d772367c1b360b2cc4d951e66860333908da43a169c8605d26202a756fcc201c47f1f29ddcdf6329381
7
- data.tar.gz: 856eeb389865dc50d1e0f81b51d5d264b918b85787a740956521e112ba1ede7808ce35766892a553e1db3dbe588852d4f8cc073d15e4eb66bd40901d459c822d
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.8)
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  module URI
4
4
  module Build
5
- VERSION = "0.1.8"
5
+ VERSION = "0.1.9"
6
6
  end
7
7
  end
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
- URI.encode_www_form value
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.8
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-05-13 00:00:00.000000000 Z
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.6
54
+ rubygems_version: 3.5.16
55
55
  signing_key:
56
56
  specification_version: 4
57
57
  summary: Build URIs via chains