Method: Protocol::HTTP::Body::File#initialize
- Defined in:
- lib/protocol/http/body/file.rb
#initialize(file, range = nil, size: file.size, block_size: BLOCK_SIZE) ⇒ File
Returns a new instance of File.
35 36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/protocol/http/body/file.rb', line 35 def initialize(file, range = nil, size: file.size, block_size: BLOCK_SIZE) @file = file @block_size = block_size if range @file.seek(range.min) @offset = range.min @length = @remaining = range.size else @offset = 0 @length = @remaining = size end end |