Class: BufferedUploadIO
- Inherits:
-
UploadIO
- Object
- UploadIO
- BufferedUploadIO
- Defined in:
- lib/support/buffered_upload_io.rb
Overview
while c = File.read(max_size); end # still reads the whole file into memory buffer = ”; while c = File.read(max_size, buffer ); end # reuses a string variable to reduce memory usage
Instance Method Summary collapse
-
#initialize(*args) ⇒ BufferedUploadIO
constructor
A new instance of BufferedUploadIO.
- #read(amount, buffer = @buffer) ⇒ Object
Constructor Details
#initialize(*args) ⇒ BufferedUploadIO
Returns a new instance of BufferedUploadIO.
4 5 6 7 |
# File 'lib/support/buffered_upload_io.rb', line 4 def initialize(*args) super(*args) @buffer = '' end |
Instance Method Details
#read(amount, buffer = @buffer) ⇒ Object
9 10 11 |
# File 'lib/support/buffered_upload_io.rb', line 9 def read(amount, buffer = @buffer) @io.read(amount, buffer) end |