Class: Zippo::CentralDirectoryEntriesUnpacker
- Inherits:
-
Object
- Object
- Zippo::CentralDirectoryEntriesUnpacker
- Defined in:
- lib/zippo/central_directory_entries_unpacker.rb
Overview
Unpacks an array of CdFileHeaders from an io stream
Instance Method Summary collapse
-
#initialize(io, size, offset) ⇒ CentralDirectoryEntriesUnpacker
constructor
A new instance of CentralDirectoryEntriesUnpacker.
- #unpack ⇒ Object
Constructor Details
#initialize(io, size, offset) ⇒ CentralDirectoryEntriesUnpacker
Returns a new instance of CentralDirectoryEntriesUnpacker.
8 9 10 11 12 13 |
# File 'lib/zippo/central_directory_entries_unpacker.rb', line 8 def initialize(io, size, offset) @io = io @size = size @offset = offset @end = @offset + @size end |
Instance Method Details
#unpack ⇒ Object
15 16 17 18 19 20 21 22 |
# File 'lib/zippo/central_directory_entries_unpacker.rb', line 15 def unpack [].tap do |entries| @io.seek @offset while @io.pos < @end && (entry = CdFileHeader::Unpacker.new(@io).unpack) entries << entry end end end |