Class: FBO::ChunkedFile
- Extended by:
- Forwardable
- Defined in:
- lib/fbo/chunked_file.rb
Constant Summary collapse
- DEFAULT_CHUNK_SIZE =
250KB
250 * 1024
Instance Attribute Summary collapse
-
#chunk_size ⇒ Object
readonly
Returns the value of attribute chunk_size.
-
#file ⇒ Object
readonly
Returns the value of attribute file.
Instance Method Summary collapse
- #contents ⇒ Object
-
#initialize(file, chunk_size = DEFAULT_CHUNK_SIZE) ⇒ ChunkedFile
constructor
A new instance of ChunkedFile.
Methods inherited from File
Constructor Details
#initialize(file, chunk_size = DEFAULT_CHUNK_SIZE) ⇒ ChunkedFile
Returns a new instance of ChunkedFile.
14 15 16 17 |
# File 'lib/fbo/chunked_file.rb', line 14 def initialize(file, chunk_size = DEFAULT_CHUNK_SIZE) @file = file @chunk_size = chunk_size end |
Instance Attribute Details
#chunk_size ⇒ Object (readonly)
Returns the value of attribute chunk_size.
7 8 9 |
# File 'lib/fbo/chunked_file.rb', line 7 def chunk_size @chunk_size end |
#file ⇒ Object (readonly)
Returns the value of attribute file.
7 8 9 |
# File 'lib/fbo/chunked_file.rb', line 7 def file @file end |
Instance Method Details
#contents ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/fbo/chunked_file.rb', line 19 def contents if @contents.nil? @contents = [] while !eof @contents << next_chunk end @contents.compact! end @contents end |