From 01d7d5bf8a7167d716d64ea3855f4bd84f3c21f0 Mon Sep 17 00:00:00 2001 From: Stephan Renatus Date: Mon, 22 Feb 2016 11:23:49 +0100 Subject: [PATCH] fetchers/tar: slight simplification --- lib/fetchers/tar.rb | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/fetchers/tar.rb b/lib/fetchers/tar.rb index 71c5afee6..f3b44cc66 100644 --- a/lib/fetchers/tar.rb +++ b/lib/fetchers/tar.rb @@ -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