Sha256: 1f2d666e7b253ef988298cc4bd25e2613704b93d8e626e9f9dddd930c2bc38e5
Contents?: true
Size: 565 Bytes
Versions: 6
Compression:
Stored size: 565 Bytes
Contents
module Files class SizableIO < IO def self.pipe r, w = super w.instance_variable_set(:@read_io, r) [r, w] end def size read_io.content_length_promise.wait.value end def fulfill_content_length(length) read_io.content_length = length read_io.content_length_promise.execute end protected attr_accessor :content_length def content_length_promise @content_length_promise ||= Concurrent::Promise.new { content_length } end def read_io @read_io || self end end end
Version data entries
6 entries across 6 versions & 1 rubygems