uri-builder 0.1.3 → 0.1.5

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: bfc6aae28ed080b625a086509de8d8f540c7b96ae18fd44ac5e9206a116160c4
4
- data.tar.gz: 55094b5b4f3e05475b9fea762c6abad86a8665c3e817b0ba17ed264f795b5b06
3
+ metadata.gz: da8233e96a3d1b8c30fc61af43c9154df26e360f355adda9754feb2d0d914404
4
+ data.tar.gz: 4f5d81c728c9dd7ca9bc953da13e2f68391a7e635edcb5eae242475c676738c2
5
5
  SHA512:
6
- metadata.gz: 120a8ea8dbd40db58885acbd69aa2dd7c6a53f1dab53facc44d3e7415efb9568470e83798156359bccc8a87a5d289426d94fefca7f62fb7aff73d010bb8079a4
7
- data.tar.gz: 4284aa8a800bd0f92156ee916dd087c1194f776291afdfc7204e17f532bb96efc97414ab72fba4193101b8a5e7816ce391218dcd80a4465c8eadb7ae95dbe94c
6
+ metadata.gz: d561a713974c5d45df2a6d160a45fa0f667d8f47b7e6f06435f97741e09b0462316e81e71bb0ae5efefd6df5eee4695ae6618c3c81e5171829fa2e233b7993f6
7
+ data.tar.gz: 238ce133061497b430efc6f0f7ea1b73a20ea11243dd08c03af762839a28a6e0a372b66dcbce30194eea9d88b5010fb2e81ab340f84a35916658e93738fa760d
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- uri-builder (0.1.3)
4
+ uri-builder (0.1.5)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,6 +2,6 @@
2
2
 
3
3
  module URI
4
4
  module Build
5
- VERSION = "0.1.3"
5
+ VERSION = "0.1.5"
6
6
  end
7
7
  end
data/lib/uri/builder.rb CHANGED
@@ -21,9 +21,20 @@ module URI
21
21
  end
22
22
 
23
23
  def scheme(value)
24
- target_scheme = URI.scheme_list[value.upcase]
25
- args = Hash[target_scheme.component.map { |attr| [ attr, @uri.send(attr) ] }]
26
- @uri = target_scheme.build(**args)
24
+ if @uri.scheme
25
+ # Handles URLs without schemes, like https://example.com/foo
26
+ target_scheme = URI.scheme_list[value.upcase]
27
+ args = Hash[target_scheme.component.map { |attr| [ attr, @uri.send(attr) ] }]
28
+ @uri = target_scheme.build(**args)
29
+ else
30
+ # Handles URLs without schemes, like example.com/foo
31
+ uri = URI.parse("#{value}://#{@uri.path}")
32
+ (uri.component - %i[host path scheme]).each do |component|
33
+ uri.send "#{component}=", @uri.send(component)
34
+ end
35
+ @uri = uri
36
+ end
37
+ self
27
38
  end
28
39
 
29
40
  def query(value)
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.3
4
+ version: 0.1.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brad Gessler
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-07-23 00:00:00.000000000 Z
11
+ date: 2023-07-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: Build URIs via chains
14
14
  email: