protocol-http 0.22.2 → 0.22.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 891c8ccab1e36efa1e8aaec311b0c451e5ecc8e3cd1a858ec01d2cb5728d14f6
4
- data.tar.gz: 9189058a0f89b42ef4dd24e307a00965129a2fbfa667d613515bea0c51b43c91
3
+ metadata.gz: ae0619e142c0e086b69d661ba9ae444330f52170bec2baff74241c7f49a906ba
4
+ data.tar.gz: 6b9b328ea74065aa14d07ba55d7f16bb5890b8df98162991cd17e92050bfaf4d
5
5
  SHA512:
6
- metadata.gz: 67b637ea3885e241224c26f2a400164bea13cd40bc2ae3517506648315fb4e6d76d91adae87b55119c26b3d85bf299fa62996ab8a19edf5cc04f781a91ef073f
7
- data.tar.gz: 05c02502dc387d9f07a358065d75ba2e659e4363f6c15a71b3acdff80be130ca00a445ce803e9f07092ccdd0cca765888cd4331b6be125ec2dd960c1449741e9
6
+ metadata.gz: 216e6bb9c9b9f399c12b4f1e8c49f62ea2d9f2529e16249554159ab09b64d6eb84630235d2ad8c01344881509f9c4920aaa8c0ba5c5e0894d928623a2c43ea0b
7
+ data.tar.gz: 3faf9365436e8b233047ee3b5a7c4393de83e31ca06c5b195e1ac7e97751b619bffaebd52c9351e02697fe9669b2f9a32514a8abdc3f0d0df5594a296aaddd39
@@ -32,6 +32,10 @@ module Protocol
32
32
  @directives = directives
33
33
  end
34
34
 
35
+ attr :name
36
+ attr :value
37
+ attr :directives
38
+
35
39
  def encoded_name
36
40
  URL.escape(@name)
37
41
  end
@@ -61,11 +65,11 @@ module Protocol
61
65
  return buffer
62
66
  end
63
67
 
64
- def self.parse string
65
- head, *options = string.split(/\s*;\s*/)
68
+ def self.parse(string)
69
+ head, *directives = string.split(/\s*;\s*/)
66
70
 
67
71
  key, value = head.split('=')
68
- directives.collect{|directive| directive.split('=', 2)}.to_h
72
+ directives = self.parse_directives(directives)
69
73
 
70
74
  self.new(
71
75
  URI.decode(key),
@@ -73,6 +77,13 @@ module Protocol
73
77
  directives,
74
78
  )
75
79
  end
80
+
81
+ def self.parse_directives(strings)
82
+ strings.collect do |string|
83
+ key, value = string.split('=', 2)
84
+ [key, value || true]
85
+ end.to_h
86
+ end
76
87
  end
77
88
  end
78
89
  end
@@ -22,6 +22,6 @@
22
22
 
23
23
  module Protocol
24
24
  module HTTP
25
- VERSION = "0.22.2"
25
+ VERSION = "0.22.3"
26
26
  end
27
27
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: protocol-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.22.2
4
+ version: 0.22.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-06-05 00:00:00.000000000 Z
11
+ date: 2021-06-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: '0'
114
114
  requirements: []
115
- rubygems_version: 3.0.3
115
+ rubygems_version: 3.1.6
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Provides abstractions to handle HTTP protocols.