Module: Tar::USTAR
- Defined in:
- lib/tar/ustar.rb
Constant Summary collapse
- RECORD_SIZE =
512
Class Method Summary collapse
Class Method Details
.read_record(io) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/tar/ustar.rb', line 11 def read_record(io) record = io.read(RECORD_SIZE) || "" raise UnexpectedEOF, "unexpected end-of-file: attempted to read #{RECORD_SIZE} bytes from #{io}, got #{record.size}" unless record.size == RECORD_SIZE record end |
.records(file_size) ⇒ Object
19 20 21 |
# File 'lib/tar/ustar.rb', line 19 def records(file_size) (file_size - 1) / RECORD_SIZE + 1 end |
.records_size(file_size) ⇒ Object
23 24 25 |
# File 'lib/tar/ustar.rb', line 23 def records_size(file_size) RECORD_SIZE * records(file_size) end |