protocol-url 0.14.0 → 0.15.0

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: 9ff041406f4bc298081aaa3f7150a374bf937f87e0f2783458082c4635d51488
4
- data.tar.gz: 90aa117ed86f9df29b3278420b8c3b450a8f6fc7b30cf6473e5fbf68bb939d40
3
+ metadata.gz: 1d1384cd7ea74826bb5dc6e145fb09c9573c807fdac7d2297164317b6caf5645
4
+ data.tar.gz: 4d4b5100c8aca8008c3be18ad9f4b79139c00251f711283a90432179e292c941
5
5
  SHA512:
6
- metadata.gz: 371901582d694902f2610377663c7aca91835c3e04fde1a06854a3b2a67456bff313d71a347686e3d7e80b1dc35cd0103379fe0abf28c6050967534f0d3ae888
7
- data.tar.gz: 8446857f07d8aa19317a1ce85e067b623df958e2a56b4df9b9110d52de1cc4eb70115d1af6ed068c5cbb9e2d78ebefd02d406ab551e36258e8acfb99276c9694
6
+ metadata.gz: f284536c31a02466b10821c12bb1a4529a023d789cafbdfae10dd71d8f3049d78f0a0dbc03f8255f3ebdb0b7278eeccd38ca81baf480e116b6fe2a4b72a0bf22
7
+ data.tar.gz: 4ae5bb2749190910c76193b6c451b47b4bbcacaded41002cc54713dc219638e4966f4522f9df2e20a7f04e1e89ab2c09c6df1497bf849afe9a202fb7ad5ceacf
checksums.yaml.gz.sig CHANGED
Binary file
@@ -145,6 +145,13 @@ module Protocol
145
145
  self.class.new(scheme, authority, path || @path, query, fragment)
146
146
  end
147
147
 
148
+ # Absolute URLs cannot be made relative without comparing their origins.
149
+ # @parameter base [Object] The ignored base URL or path.
150
+ # @returns [self] This absolute URL.
151
+ def relative_to(base)
152
+ return self
153
+ end
154
+
148
155
  # Convert the URL to an array representation.
149
156
  #
150
157
  # @returns [Array] An array of `[scheme, authority, path, query, fragment]`.
@@ -132,6 +132,23 @@ module Protocol
132
132
  self.class.new(path || @path, query, fragment)
133
133
  end
134
134
 
135
+ # Express this URL relative to the given base path.
136
+ #
137
+ # Already-relative paths are returned unchanged. Query and fragment components
138
+ # are preserved when converting a root-relative path.
139
+ #
140
+ # @parameter base [Relative | Path | String] The base URL or path.
141
+ # @returns [Relative] The relative URL.
142
+ def relative_to(base)
143
+ return self unless @path.absolute?
144
+
145
+ if base.is_a?(Relative)
146
+ base = base.path
147
+ end
148
+
149
+ return self.class.new(@path.relative(base), @query, @fragment)
150
+ end
151
+
135
152
  # Normalize the encoded path and simplify its structure.
136
153
  #
137
154
  # This modifies the URL in-place by normalizing and simplifying the path component:
@@ -7,6 +7,6 @@
7
7
  module Protocol
8
8
  # @namespace
9
9
  module URL
10
- VERSION = "0.14.0"
10
+ VERSION = "0.15.0"
11
11
  end
12
12
  end
data/readme.md CHANGED
@@ -34,6 +34,47 @@ bundle exec sus
34
34
 
35
35
  Please see the [project releases](https://socketry.github.io/protocol-url/releases/index) for all releases.
36
36
 
37
+ ### v0.15.0
38
+
39
+ - Add `Protocol::URL::Relative#relative_to` for expressing root-relative URLs relative to a base path.
40
+
41
+ ### v0.14.0
42
+
43
+ - Allow paths to compare with their encoded string representation.
44
+
45
+ ### v0.13.0
46
+
47
+ - Add conservative normalization of encoded URL paths.
48
+
49
+ ### v0.12.0
50
+
51
+ - Allow unfrozen relative and absolute URLs to replace their components.
52
+
53
+ ### v0.10.0
54
+
55
+ - Rename `Protocol::URL::FormData::Parser::CONTENT_TYPE` to `MEDIA_TYPE`.
56
+
57
+ ### v0.9.0
58
+
59
+ - Add `Protocol::URL::LimitError` for configured processing limits.
60
+
61
+ ### v0.8.0
62
+
63
+ - Use consistent limit naming for form data parser constraints.
64
+
65
+ ### v0.7.0
66
+
67
+ - Allow `Protocol::URL::FormData::Parser#parse` to populate a supplied result object.
68
+
69
+ ### v0.6.0
70
+
71
+ - Add `Protocol::URL::FormData::Parser` for incremental, limited parsing of `application/x-www-form-urlencoded` form data.
72
+ - Add `Protocol::URL::FormData::Nested` for consistently building nested form data while preserving absent and empty values.
73
+
74
+ ### v0.5.0
75
+
76
+ - Add `Protocol::URL::Encoding.decode_www_form` for decoding HTML form data where `+` represents a space.
77
+
37
78
  ### v0.14.0
38
79
 
39
80
  - Allow paths to compare with their encoded string representation.
data/releases.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Releases
2
2
 
3
+ ## v0.15.0
4
+
5
+ - Add `Protocol::URL::Relative#relative_to` for expressing root-relative URLs relative to a base path.
6
+
3
7
  ## v0.14.0
4
8
 
5
9
  - Allow paths to compare with their encoded string representation.
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-url
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.14.0
4
+ version: 0.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
metadata.gz.sig CHANGED
Binary file