fetchers/tar: slight simplification

This commit is contained in:
Stephan Renatus 2016-02-22 11:23:49 +01:00 committed by Dominik Richter
parent c24a504cb6
commit 01d7d5bf8a

View file

@ -34,14 +34,10 @@ module Fetchers
def read_from_tar(file)
return nil unless @files.include?(file)
res = nil
# NB `TarReader` includes `Enumerable` beginning with Ruby 2.x
Gem::Package::TarReader.new(Zlib::GzipReader.open(@target)) do |tar|
tar.each do |entry|
next if entry.directory?
# ignore symlinks for now
next if entry.header.typeflag == '2'
# only handle files for now
next unless entry.file?
next unless file == entry.full_name
next unless entry.file? && file == entry.full_name
res = entry.read
break
end