Sha256: bb8a8b0e135fd092788d81f21a946d00498d0bf747095e5fae926c3f52ae37ef
Contents?: true
Size: 653 Bytes
Versions: 36
Compression:
Stored size: 653 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 def close super read_io.content_length_promise.try_set(nil) 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
36 entries across 36 versions & 1 rubygems