lib/async/http/body/writable.rb in async-http-0.35.0 vs lib/async/http/body/writable.rb in async-http-0.35.1
- old
+ new
@@ -28,18 +28,24 @@
# A dynamic body which you can write to and read from.
class Writable < Readable
class Closed < StandardError
end
- def initialize
+ def initialize(length = nil)
@queue = Async::Queue.new
+ @length = length
+
@count = 0
@finished = false
@closed = false
@error = nil
+ end
+
+ def length
+ @length
end
# Stop generating output; cause the next call to write to fail with the given error.
def close(error = nil)
unless @closed