class Sgfa::Web::FileBody
Provide the contents of a file in chunks. Designed to work with Rack response.
Constants
- ReadChunk
Size of the chunks provided by each
Public Class Methods
new(file)
click to toggle source
initialize new file response
# File lib/sgfa/web/base.rb, line 207 def initialize(file) @file = file end
Public Instance Methods
close()
click to toggle source
close
# File lib/sgfa/web/base.rb, line 220 def close if @file.respond_to?(:close!) @file.close! else @file.close end end
each() { |str| ... }
click to toggle source
provide the body of the file
# File lib/sgfa/web/base.rb, line 212 def each str = '' while @file.read(ReadChunk, str) yield str end end