Class: Tar::HeaderReader

Inherits:
Object
  • Object
show all
Defined in:
lib/tar/header_reader.rb

Instance Method Summary collapse

Constructor Details

#initialize(io) ⇒ HeaderReader

Returns a new instance of HeaderReader.



12
13
14
# File 'lib/tar/header_reader.rb', line 12

def initialize(io)
  @io = io
end

Instance Method Details

#readObject



16
17
18
19
20
21
22
23
24
25
# File 'lib/tar/header_reader.rb', line 16

def read
  record = read_record

  if empty?(record)
    return nil if empty?(read_record)
    raise InvalidArchive, "empty header"
  end

  Header.parse(record)
end