uri-builder 0.1.5 → 0.1.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile.lock +15 -14
- data/README.md +7 -1
- data/lib/uri/builder/version.rb +1 -1
- data/lib/uri/builder.rb +11 -1
- data/uri-transform.gemspec +1 -1
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dcf102df8c512ad97ce8a69bcd049a64258ebf11bc926a8efe0055a5180b841d
|
4
|
+
data.tar.gz: 0610c9fc48e38b36202da6eeca26144c6031f832816a6fb2eb10aa34933b1cd1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77e4655830d08c3ec0f19ed382484c57c4c892f72a63405c25949cb13f9123a27df93083fb7e8e0b00b3fcb849ad824910ea6681eef5129dc7eca0557e9322a4
|
7
|
+
data.tar.gz: 781cb2d65ef79aa107876e69d4db8a8790666f360dde39884f2019dbf357a816923d318abba25b1bc424ab4e35da4b699c6524cac91fac1fd4427b589fac53fc
|
data/Gemfile.lock
CHANGED
@@ -1,30 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
uri-builder (0.1.
|
4
|
+
uri-builder (0.1.7)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
8
8
|
specs:
|
9
|
-
diff-lcs (1.5.
|
10
|
-
rake (13.0
|
11
|
-
rspec (3.
|
12
|
-
rspec-core (~> 3.
|
13
|
-
rspec-expectations (~> 3.
|
14
|
-
rspec-mocks (~> 3.
|
15
|
-
rspec-core (3.
|
16
|
-
rspec-support (~> 3.
|
17
|
-
rspec-expectations (3.
|
9
|
+
diff-lcs (1.5.1)
|
10
|
+
rake (13.1.0)
|
11
|
+
rspec (3.13.0)
|
12
|
+
rspec-core (~> 3.13.0)
|
13
|
+
rspec-expectations (~> 3.13.0)
|
14
|
+
rspec-mocks (~> 3.13.0)
|
15
|
+
rspec-core (3.13.0)
|
16
|
+
rspec-support (~> 3.13.0)
|
17
|
+
rspec-expectations (3.13.0)
|
18
18
|
diff-lcs (>= 1.2.0, < 2.0)
|
19
|
-
rspec-support (~> 3.
|
20
|
-
rspec-mocks (3.
|
19
|
+
rspec-support (~> 3.13.0)
|
20
|
+
rspec-mocks (3.13.0)
|
21
21
|
diff-lcs (>= 1.2.0, < 2.0)
|
22
|
-
rspec-support (~> 3.
|
23
|
-
rspec-support (3.
|
22
|
+
rspec-support (~> 3.13.0)
|
23
|
+
rspec-support (3.13.1)
|
24
24
|
|
25
25
|
PLATFORMS
|
26
26
|
arm64-darwin-21
|
27
27
|
arm64-darwin-22
|
28
|
+
arm64-darwin-23
|
28
29
|
x86_64-darwin-20
|
29
30
|
|
30
31
|
DEPENDENCIES
|
data/README.md
CHANGED
@@ -6,6 +6,12 @@ URI builder makes working with URLs in Ruby a little less awkward by chaining me
|
|
6
6
|
URI.build("https://www.example.com/api/v1").path("/api/v2").query(search: "great books").uri
|
7
7
|
```
|
8
8
|
|
9
|
+
Or if you prefer a block format that automatically converts back to an URI object after the transformation.
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
URI.build("https://www.example.com/api/v1") { _1.path("/api/v2").query search: "great books" }
|
13
|
+
```
|
14
|
+
|
9
15
|
Compare that to:
|
10
16
|
|
11
17
|
```ruby
|
@@ -50,4 +56,4 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
50
56
|
|
51
57
|
## Contributing
|
52
58
|
|
53
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
59
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/rubymonolith/uri-builder.
|
data/lib/uri/builder/version.rb
CHANGED
data/lib/uri/builder.rb
CHANGED
@@ -57,6 +57,10 @@ module URI
|
|
57
57
|
uri.to_s
|
58
58
|
end
|
59
59
|
|
60
|
+
def to_str
|
61
|
+
uri.to_str
|
62
|
+
end
|
63
|
+
|
60
64
|
private
|
61
65
|
def wrap(property, value)
|
62
66
|
@uri.send "#{property}=", value
|
@@ -70,7 +74,13 @@ module URI
|
|
70
74
|
end
|
71
75
|
|
72
76
|
def self.build(value)
|
73
|
-
|
77
|
+
if block_given?
|
78
|
+
URI(value).build.tap do |uri|
|
79
|
+
yield uri
|
80
|
+
end.uri
|
81
|
+
else
|
82
|
+
URI(value).build
|
83
|
+
end
|
74
84
|
end
|
75
85
|
|
76
86
|
def self.env(key, default = nil)
|
data/uri-transform.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |spec|
|
|
10
10
|
|
11
11
|
spec.summary = "Build URIs via chains"
|
12
12
|
spec.description = spec.summary
|
13
|
-
spec.homepage = "https://github.com/
|
13
|
+
spec.homepage = "https://github.com/rubymonolith/uri-builder"
|
14
14
|
spec.required_ruby_version = ">= 2.6.0"
|
15
15
|
|
16
16
|
spec.metadata["allowed_push_host"] = "https://rubygems.org"
|
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.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brad Gessler
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-03-15 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Build URIs via chains
|
14
14
|
email:
|
@@ -27,13 +27,13 @@ files:
|
|
27
27
|
- lib/uri/builder/version.rb
|
28
28
|
- sig/uri/transform.rbs
|
29
29
|
- uri-transform.gemspec
|
30
|
-
homepage: https://github.com/
|
30
|
+
homepage: https://github.com/rubymonolith/uri-builder
|
31
31
|
licenses: []
|
32
32
|
metadata:
|
33
33
|
allowed_push_host: https://rubygems.org
|
34
|
-
homepage_uri: https://github.com/
|
35
|
-
source_code_uri: https://github.com/
|
36
|
-
changelog_uri: https://github.com/
|
34
|
+
homepage_uri: https://github.com/rubymonolith/uri-builder
|
35
|
+
source_code_uri: https://github.com/rubymonolith/uri-builder
|
36
|
+
changelog_uri: https://github.com/rubymonolith/uri-builder
|
37
37
|
post_install_message:
|
38
38
|
rdoc_options: []
|
39
39
|
require_paths:
|
@@ -49,7 +49,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '0'
|
51
51
|
requirements: []
|
52
|
-
rubygems_version: 3.
|
52
|
+
rubygems_version: 3.5.6
|
53
53
|
signing_key:
|
54
54
|
specification_version: 4
|
55
55
|
summary: Build URIs via chains
|