Class: Roda::RodaPlugins::Chunked::StreamBody
- Inherits:
-
Object
- Object
- Roda::RodaPlugins::Chunked::StreamBody
- Defined in:
- lib/roda/plugins/chunked.rb
Overview
Rack response body instance for chunked responses not using Transfer-Encoding: chunked.
Instance Method Summary collapse
-
#each(&block) ⇒ Object
Yield each non-empty chunk as the body.
-
#initialize(scope) ⇒ StreamBody
constructor
Save the scope of the current request handling.
Constructor Details
#initialize(scope) ⇒ StreamBody
Save the scope of the current request handling.
196 197 198 |
# File 'lib/roda/plugins/chunked.rb', line 196 def initialize(scope) @scope = scope end |
Instance Method Details
#each(&block) ⇒ Object
Yield each non-empty chunk as the body.
201 202 203 204 205 |
# File 'lib/roda/plugins/chunked.rb', line 201 def each(&block) @scope.each_chunk do |chunk| yield chunk if chunk && !chunk.empty? end end |