Sha256: 2eda66d17e72b420f6f550063cc74161b0e3f7b54f265d294de66ee6b29d0b1c
Contents?: true
Size: 848 Bytes
Versions: 4
Compression:
Stored size: 848 Bytes
Contents
optional_require 'zip/zip' module ETL module Processor # Custom processor to zip files class ZipFileProcessor < ETL::Processor::Processor attr_reader :infile attr_reader :destination # configuration options include: # * infile - File to zip (required) # * destination - Zip file name (default: #{infile}.zip) def initialize(control, configuration) path = Pathname.new(configuration[:infile]) @infile = path.absolute? ? path : Pathname.new(File.dirname(File.expand_path(configuration[:infile]))) + path @destination = configuration[:destination] || "#{infile}.zip" end def process Zip::ZipFile.open(@destination, Zip::ZipFile::CREATE) do |zipfile| zipfile.add(@infile.basename, @infile) end end end end end
Version data entries
4 entries across 4 versions & 3 rubygems