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 +4 -4
- checksums.yaml.gz.sig +0 -0
- data/lib/protocol/url/absolute.rb +7 -0
- data/lib/protocol/url/relative.rb +17 -0
- data/lib/protocol/url/version.rb +1 -1
- data/readme.md +41 -0
- data/releases.md +4 -0
- data.tar.gz.sig +0 -0
- metadata +1 -1
- metadata.gz.sig +0 -0
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 1d1384cd7ea74826bb5dc6e145fb09c9573c807fdac7d2297164317b6caf5645
|
|
4
|
+
data.tar.gz: 4d4b5100c8aca8008c3be18ad9f4b79139c00251f711283a90432179e292c941
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
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:
|
data/lib/protocol/url/version.rb
CHANGED
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
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|