class FastSend::NaiveEach
Gets used as a response body wrapper if the server does not support Rack hijacking. The wrapper will be automatically applied by FastSend
and will also ensure that all the callbacks get executed.
Public Instance Methods
each() { |data| ... }
click to toggle source
# File lib/fast_send.rb, line 57 def each written = 0 started.call(0) body_with_each_file.each_file do | file | while data = file.read(64 * 1024) written += data.bytesize yield(data) sent.call(data.bytesize, written) end end complete.call(written) rescue *CLIENT_DISCONNECTS => e aborted.call(e) rescue Exception => e aborted.call(e) error.call(e) raise e ensure cleanup.call(written) end