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.
198 199 200 |
# File 'lib/roda/plugins/chunked.rb', line 198 def initialize(scope) @scope = scope end |
Instance Method Details
#each(&block) ⇒ Object
Yield each non-empty chunk as the body.
203 204 205 206 207 |
# File 'lib/roda/plugins/chunked.rb', line 203 def each(&block) @scope.each_chunk do |chunk| yield chunk if chunk && !chunk.empty? end end |