Method: CPIO::ArchiveHeader#to_data

Defined in:
lib/excavate/extractors/cpio/cpio_old_format.rb

#to_dataObject



72
73
74
75
76
77
78
79
# File 'lib/excavate/extractors/cpio/cpio_old_format.rb', line 72

def to_data
  Fields.collect do |(width,name)|
    raise ArchiveFormatError, "Expected header to have key #{name}" unless @attrs.has_key?(name)
    val = @attrs[name].respond_to?(:to_proc) ? @attrs[name].call : @attrs[name]
    raise ArchiveFormatError, "Header value for #{name} exceeds max length of #{FieldMaxValues[name]}" if val > FieldMaxValues[name]
    sprintf("%0*o", Fields.rassoc(name).first, val)
  end.join('')
end