async-http 0.25.0 → 0.26.0

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: 232e1b617ad6dea60e2b7d5ccbd1838bd1a507d6896292dab3345cb439ee7638
4
- data.tar.gz: 51877e29175a10fabe6bd36b10d675b09eb90447b16a4e59ba3a8c128f4b9940
3
+ metadata.gz: f41c8e5613af9f0522c24461c31c8cdc410ca04f04fecd3b1e727c716e245f1c
4
+ data.tar.gz: 965be2b71c176eb7f11c05b182551be39bc17371997b50ea1ca3e8a9745934ec
5
5
  SHA512:
6
- metadata.gz: 61215be764f44c9b46378c7eb6582850936f3cbf0d424f8967fa38141ee109469c3cde72f343807919fb0a5a9fc31a191a6441c15832c6370279a395da8e1a16
7
- data.tar.gz: 63f6fdd40cfc107ef03234615ed92d8a9a7f76305e48bbb6638a177d148a38f626650aa3d83671d0438ac0a2652f301e722d08f9626db5886288028359fbf682
6
+ metadata.gz: c080e937e8daf6914b9b9f0b37ef16f310fde136f9d834b4a7be11f9a13239927c8ec9e6ec51143b5b27e4f4141a0a9859c321a4d252c60caf3ea0e827537857
7
+ data.tar.gz: ab34e94fbd6ce5e5e73d8509dd506c3044c95f30d9f37e68491b4426c047a94cab5265c912bca6b5be662bbf2cc01c06f3d1639900d655c98360087685f5a98e
@@ -87,7 +87,7 @@ module Async
87
87
  end
88
88
 
89
89
  def inspect
90
- "\#<#{self.class} #{@chunks.count} chunks, #{self.bytesize} bytes>"
90
+ "\#<#{self.class} #{@chunks.count} chunks, #{self.length} bytes>"
91
91
  end
92
92
 
93
93
  module Reader
@@ -0,0 +1,59 @@
1
+ # Copyright, 2018, by Samuel G. D. Williams. <http://www.codeotaku.com>
2
+ #
3
+ # Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ # of this software and associated documentation files (the "Software"), to deal
5
+ # in the Software without restriction, including without limitation the rights
6
+ # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ # copies of the Software, and to permit persons to whom the Software is
8
+ # furnished to do so, subject to the following conditions:
9
+ #
10
+ # The above copyright notice and this permission notice shall be included in
11
+ # all copies or substantial portions of the Software.
12
+ #
13
+ # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
19
+ # THE SOFTWARE.
20
+
21
+ require_relative 'wrapper'
22
+
23
+ module Async
24
+ module HTTP
25
+ module Body
26
+ # A body which buffers all it's contents.
27
+ class Rewindable < Wrapper
28
+ def initialize(body)
29
+ super(body)
30
+
31
+ @chunks = []
32
+ @index = 0
33
+ end
34
+
35
+ def read
36
+ if @index < @chunks.count
37
+ chunk = @chunks[@index]
38
+ @index += 1
39
+ else
40
+ if chunk = super
41
+ @chunks << chunk
42
+ @index += 1
43
+ end
44
+ end
45
+
46
+ return chunk
47
+ end
48
+
49
+ def rewind
50
+ @index = 0
51
+ end
52
+
53
+ def inspect
54
+ "\#<#{self.class} #{@index}/#{@chunks.count} chunks read>"
55
+ end
56
+ end
57
+ end
58
+ end
59
+ end
@@ -20,6 +20,6 @@
20
20
 
21
21
  module Async
22
22
  module HTTP
23
- VERSION = "0.25.0"
23
+ VERSION = "0.26.0"
24
24
  end
25
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: async-http
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.25.0
4
+ version: 0.26.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Samuel Williams
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-06-25 00:00:00.000000000 Z
11
+ date: 2018-06-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: async
@@ -146,6 +146,7 @@ files:
146
146
  - lib/async/http/body/fixed.rb
147
147
  - lib/async/http/body/inflate.rb
148
148
  - lib/async/http/body/readable.rb
149
+ - lib/async/http/body/rewindable.rb
149
150
  - lib/async/http/body/streamable.rb
150
151
  - lib/async/http/body/wrapper.rb
151
152
  - lib/async/http/body/writable.rb