Class: HTTP::Features::AutoDeflate::CompressedBody
- Inherits:
-
Object
- Object
- HTTP::Features::AutoDeflate::CompressedBody
show all
- Defined in:
- lib/http/features/auto_deflate.rb
Instance Method Summary
collapse
Constructor Details
Returns a new instance of CompressedBody.
31
32
33
34
|
# File 'lib/http/features/auto_deflate.rb', line 31
def initialize(body)
@body = body
@compressed = nil
end
|
Instance Method Details
#each(&block) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
|
# File 'lib/http/features/auto_deflate.rb', line 41
def each(&block)
return to_enum __method__ unless block
if @compressed
compressed_each(&block)
else
compress(&block)
end
self
end
|
#size ⇒ Object
36
37
38
39
|
# File 'lib/http/features/auto_deflate.rb', line 36
def size
compress_all! unless @compressed
@compressed.size
end
|