Method: Rack::Archive::Zip::Extract::ExtractedFile#initialize

Defined in:
lib/rack/archive/zip/extract.rb

#initialize(archive, path, buffer_size = BUFFER_SIZE) ⇒ ExtractedFile

Returns a new instance of ExtractedFile.

Parameters:

  • archive (Zip::Archive)
  • path (String)
  • buffer_size (Integer) (defaults to: BUFFER_SIZE)

Raises:

  • ArgumentError when archive already closed



134
135
136
137
138
139
140
141
142
# File 'lib/rack/archive/zip/extract.rb', line 134

def initialize(archive, path, buffer_size=BUFFER_SIZE)
  raise ArgumentError, 'archive already closed' unless archive.open?
  @archive = archive
  @file = @archive.fopen(path)
  @mtime = @file.mtime
  @size = @file.size
  @etag = Digest::MD5.hexdigest(@file.name) + @mtime.to_i.to_s(16) + @size.to_s(16)
  @buffer_size = buffer_size
end