Class: HTTP::Request::Body::ProcIO
- Inherits:
-
Object
- Object
- HTTP::Request::Body::ProcIO
- Defined in:
- lib/http/request/body.rb
Overview
This class provides a "writable IO" wrapper around a proc object, with
write simply calling the proc, which we can pass in as the
"destination IO" in IO.copy_stream.
Instance Method Summary collapse
-
#initialize(block) ⇒ ProcIO
constructor
A new instance of ProcIO.
- #write(data) ⇒ Object
Constructor Details
#initialize(block) ⇒ ProcIO
Returns a new instance of ProcIO.
89 90 91 |
# File 'lib/http/request/body.rb', line 89 def initialize(block) @block = block end |
Instance Method Details
#write(data) ⇒ Object
93 94 95 96 |
# File 'lib/http/request/body.rb', line 93 def write(data) @block.call(data) data.bytesize end |