Class: Rack::Chunked::Body
- Inherits:
-
Object
- Object
- Rack::Chunked::Body
- Includes:
- Utils
- Defined in:
- rack/rack/chunked.rb
Overview
A body wrapper that emits chunked responses
Constant Summary
- TERM =
"\r\n"
- TAIL =
"0#{TERM}#{TERM}"
Class Attribute Summary (collapse)
-
+ (void) key_space_limit
extended
from Utils
Returns the value of attribute key_space_limit.
Instance Method Summary (collapse)
- - (void) close
- - (void) each {|TAIL| ... }
-
- (Body) initialize(body)
constructor
A new instance of Body.
Constructor Details
- (Body) initialize(body)
Returns a new instance of Body
17 18 19 |
# File 'rack/rack/chunked.rb', line 17 def initialize(body) @body = body end |
Class Attribute Details
+ (void) key_space_limit Originally defined in module Utils
Returns the value of attribute key_space_limit
Instance Method Details
- (void) close
33 34 35 |
# File 'rack/rack/chunked.rb', line 33 def close @body.close if @body.respond_to?(:close) end |
- (void) each {|TAIL| ... }
21 22 23 24 25 26 27 28 29 30 31 |
# File 'rack/rack/chunked.rb', line 21 def each term = TERM @body.each do |chunk| size = bytesize(chunk) next if size == 0 chunk = chunk.dup.force_encoding(Encoding::BINARY) if chunk.respond_to?(:force_encoding) yield [size.to_s(16), term, chunk, term].join end yield TAIL end |