class IntervalResponse::LazyFile

Used so that if a sequence of files gets served out, the files should not be kept open during the entire response output - as this might exhaust the file descriptor table

Public Class Methods

new(filesystem_path) click to toggle source
# File lib/interval_response/lazy_file.rb, line 6
def initialize(filesystem_path)
  @fs_path = filesystem_path
end

Public Instance Methods

size() click to toggle source
# File lib/interval_response/lazy_file.rb, line 10
def size
  File.size(@fs_path)
end
with() { |file_handle| ... } click to toggle source
# File lib/interval_response/lazy_file.rb, line 14
def with
  File.open(@fs_path, 'rb') do |file_handle|
    yield file_handle
  end
end