Class: HTTPX::ProcIO
- Inherits:
-
Object
- Object
- HTTPX::ProcIO
- Defined in:
- lib/httpx/request/body.rb
Overview
Wrapper yielder which can be used with functions which expect an IO writer.
Instance Method Summary collapse
-
#initialize(block) ⇒ ProcIO
constructor
A new instance of ProcIO.
-
#write(data) ⇒ Object
Implementation the IO write protocol, which yield the given chunk to @block.
Constructor Details
#initialize(block) ⇒ ProcIO
Returns a new instance of ProcIO.
148 149 150 |
# File 'lib/httpx/request/body.rb', line 148 def initialize(block) @block = block end |
Instance Method Details
#write(data) ⇒ Object
Implementation the IO write protocol, which yield the given chunk to @block.
153 154 155 156 |
# File 'lib/httpx/request/body.rb', line 153 def write(data) @block.call(data.dup) data.bytesize end |