protocol-url 0.6.0 → 0.7.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/form_data/parser.rb +8 -5
- data/lib/protocol/url/version.rb +1 -1
- data/readme.md +4 -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: 38bcf53ee312963527020be6c4a4c18697587ad4ecd75277552b1dbd744e0ec9
|
|
4
|
+
data.tar.gz: 85f2886788dfec25b6799f3c92d79f8bb31fbb5f48f3b017fca94993a21b507b
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c5870caa5923cc4918e909470522231f132946f3235a8b396dff155adcab311ab0a1743da9ae1de96c92d2427c6e61cb758760dc2a3133005c4b0929225a4af5
|
|
7
|
+
data.tar.gz: 820c6b061491cd83b553f38b5d53573cc641d76ad63be859e2835698e0b7242ae908763758b1730dd3b56a3f5a82dfe11d2f2de0cfafe12bd87ef66d4e405c17
|
checksums.yaml.gz.sig
CHANGED
|
Binary file
|
|
@@ -34,17 +34,16 @@ module Protocol
|
|
|
34
34
|
# When a block is given, each decoded value is passed through the block before assignment. The value returned by the block is assigned to the result.
|
|
35
35
|
#
|
|
36
36
|
# @parameter body [Object] A readable body which yields chunks from `#read`.
|
|
37
|
+
# @parameter result [Object] The result to populate. It must support `#add` and `#to_h`.
|
|
37
38
|
# @yields {|name, value| ...} Each decoded form pair before assignment.
|
|
38
39
|
# @returns [Hash] The nested form data.
|
|
39
|
-
def parse(body)
|
|
40
|
-
nested = Nested.new(maximum_depth: @maximum_depth)
|
|
41
|
-
|
|
40
|
+
def parse(body, result = make_result)
|
|
42
41
|
each(body) do |name, value|
|
|
43
42
|
value = yield(name, value) if block_given?
|
|
44
|
-
|
|
43
|
+
result.add(name, value)
|
|
45
44
|
end
|
|
46
45
|
|
|
47
|
-
return
|
|
46
|
+
return result.to_h
|
|
48
47
|
end
|
|
49
48
|
|
|
50
49
|
# Incrementally enumerate URL-encoded form data as ordered name/value pairs.
|
|
@@ -88,6 +87,10 @@ module Protocol
|
|
|
88
87
|
|
|
89
88
|
private
|
|
90
89
|
|
|
90
|
+
def make_result
|
|
91
|
+
return Nested.new(maximum_depth: @maximum_depth)
|
|
92
|
+
end
|
|
93
|
+
|
|
91
94
|
def yield_pair(assignment)
|
|
92
95
|
name, value = assignment.split("=", 2)
|
|
93
96
|
|
data/lib/protocol/url/version.rb
CHANGED
data/readme.md
CHANGED
|
@@ -34,6 +34,10 @@ This project is best served by a collaborative and respectful environment. Treat
|
|
|
34
34
|
|
|
35
35
|
Please see the [project releases](https://socketry.github.io/protocol-url/releases/index) for all releases.
|
|
36
36
|
|
|
37
|
+
### v0.7.0
|
|
38
|
+
|
|
39
|
+
- Allow `Protocol::URL::FormData::Parser#parse` to populate a supplied result object.
|
|
40
|
+
|
|
37
41
|
### v0.6.0
|
|
38
42
|
|
|
39
43
|
- Add `Protocol::URL::FormData::Parser` for incremental, limited parsing of `application/x-www-form-urlencoded` form data.
|
data/releases.md
CHANGED
data.tar.gz.sig
CHANGED
|
Binary file
|
metadata
CHANGED
metadata.gz.sig
CHANGED
|
Binary file
|