Module: Typhoeus::Request::Streamable
- Included in:
- Typhoeus::Request
- Defined in:
- lib/typhoeus/request/streamable.rb
Overview
This module contians the logic for response streaming.
Instance Method Summary collapse
-
#on_body(&block) {|Typhoeus::Response, String| ... } ⇒ Array<Block>
Set on_body callback.
-
#streaming? ⇒ Boolean
Is this request using streaming?.
Instance Method Details
#on_body(&block) {|Typhoeus::Response, String| ... } ⇒ Array<Block>
Set on_body callback.
This callback will be called each time a portion of the body is read from the socket. Setting an on_body callback will cause the response body to be empty.
20 21 22 23 24 |
# File 'lib/typhoeus/request/streamable.rb', line 20 def on_body(&block) @on_body ||= [] @on_body << block if block_given? @on_body end |
#streaming? ⇒ Boolean
Is this request using streaming?
29 30 31 |
# File 'lib/typhoeus/request/streamable.rb', line 29 def streaming? defined?(@on_body) && @on_body.any? end |