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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: da8233e96a3d1b8c30fc61af43c9154df26e360f355adda9754feb2d0d914404
4
- data.tar.gz: 4f5d81c728c9dd7ca9bc953da13e2f68391a7e635edcb5eae242475c676738c2
3
+ metadata.gz: dcf102df8c512ad97ce8a69bcd049a64258ebf11bc926a8efe0055a5180b841d
4
+ data.tar.gz: 0610c9fc48e38b36202da6eeca26144c6031f832816a6fb2eb10aa34933b1cd1
5
5
  SHA512:
6
- metadata.gz: d561a713974c5d45df2a6d160a45fa0f667d8f47b7e6f06435f97741e09b0462316e81e71bb0ae5efefd6df5eee4695ae6618c3c81e5171829fa2e233b7993f6
7
- data.tar.gz: 238ce133061497b430efc6f0f7ea1b73a20ea11243dd08c03af762839a28a6e0a372b66dcbce30194eea9d88b5010fb2e81ab340f84a35916658e93738fa760d
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.5)
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.0)
10
- rake (13.0.6)
11
- rspec (3.10.0)
12
- rspec-core (~> 3.10.0)
13
- rspec-expectations (~> 3.10.0)
14
- rspec-mocks (~> 3.10.0)
15
- rspec-core (3.10.2)
16
- rspec-support (~> 3.10.0)
17
- rspec-expectations (3.10.2)
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.10.0)
20
- rspec-mocks (3.10.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.10.0)
23
- rspec-support (3.10.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/rocketshipio/uri-builder.
59
+ Bug reports and pull requests are welcome on GitHub at https://github.com/rubymonolith/uri-builder.
@@ -2,6 +2,6 @@
2
2
 
3
3
  module URI
4
4
  module Build
5
- VERSION = "0.1.5"
5
+ VERSION = "0.1.7"
6
6
  end
7
7
  end
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
- URI(value).build
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)
@@ -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/rocketshipio/url-builder"
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.5
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: 2023-07-24 00:00:00.000000000 Z
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/rocketshipio/url-builder
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/rocketshipio/url-builder
35
- source_code_uri: https://github.com/rocketshipio/url-builder
36
- changelog_uri: https://github.com/rocketshipio/url-builder
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.4.6
52
+ rubygems_version: 3.5.6
53
53
  signing_key:
54
54
  specification_version: 4
55
55
  summary: Build URIs via chains