Sha256: 8697b70d3c3b44b7c585d5ef411ad69fa7e3678d054391e6dabf84f6e16199ef
Contents?: true
Size: 1.14 KB
Versions: 1
Compression:
Stored size: 1.14 KB
Contents
require "transformator/processor" class Transformator::TarReader < Transformator::Processor require_relative "./tar_reader/patched_rubygems_tar_reader" attr_accessor :files def initialize(options = {}) @bulk_size = options["bulk_size"] @current_archive_enumerator = nil if options["files"] @files = ensure_array(options["files"]).map do |filename| Dir.glob(File.expand_path(filename)) end.flatten end end def call!(state) @files = state.result.slice!(0..-1) unless @files if @current_archive_enumerator.nil? if !@files.empty? @current_archive_enumerator = PatchedRubygemsTarReader.new( Zlib::GzipReader.open( File.expand_path(@files.pop) ) ).each else state.finished = true end end @bulk_size.times do begin if @current_archive_enumerator state.result.push @current_archive_enumerator.next end rescue StopIteration @current_archive_enumerator = nil end end end # private # def ensure_array(object) object.is_a?(Array) ? object : [object] end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
transformator-1.0.0.pre1 | lib/transformator/tar_reader.rb |