File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -27,6 +27,9 @@ class Chunked < Readable
27
27
def initialize ( protocol )
28
28
@protocol = protocol
29
29
@finished = false
30
+
31
+ @bytesize = 0
32
+ @count = 0
30
33
end
31
34
32
35
def empty?
@@ -49,11 +52,14 @@ def read
49
52
chunk = @protocol . stream . read ( size )
50
53
@protocol . read_line # Consume the trailing CRLF
51
54
55
+ @bytesize += size
56
+ @count += 1
57
+
52
58
return chunk
53
59
end
54
60
55
61
def inspect
56
- "\# <#{ self . class } #{ @protocol . version } >"
62
+ "\# <#{ self . class } #{ @bytesize } bytes read in #{ @count } chunks >"
57
63
end
58
64
end
59
65
end
Original file line number Diff line number Diff line change @@ -53,7 +53,7 @@ def join
53
53
end
54
54
55
55
def inspect
56
- "\# <#{ self . class } #{ protocol . version } length=#{ @length } remaining=#{ @remaining } >"
56
+ "\# <#{ self . class } length=#{ @length } remaining=#{ @remaining } >"
57
57
end
58
58
end
59
59
@@ -75,7 +75,7 @@ def join
75
75
end
76
76
77
77
def inspect
78
- "\# <#{ self . class } #{ protocol . version } #{ @stream . closed? ? 'closed' : 'open' } >"
78
+ "\# <#{ self . class } #{ @stream . closed? ? 'closed' : 'open' } >"
79
79
end
80
80
end
81
81
end
You can’t perform that action at this time.
0 commit comments