Sha256: df912499c2a82036ef88ba23dd7204e6bc8fcdaedd888b85e6bb69adac88d3db
Contents?: true
Size: 898 Bytes
Versions: 2
Compression:
Stored size: 898 Bytes
Contents
require 'tempfile' require 'komic/utils' require 'zip' module Komic::Builder class Zip attr_reader :images def initialize(type_string, options) @options = options @zip_path = File.join(Dir.pwd, type_string) end def images images = [] ::Zip::File.open(@zip_path) do |zip_file| zip_file. sort_by { |x| File.basename(x.name).split('.')[0].to_i }. select { |x| File.fnmatch?(FNMATCH_FOR_IMAGE, x.name, File::FNM_EXTGLOB) }. each do |entry| p entry.name will_be_write = Tempfile.new("#{ entry.name }") image = MiniMagick::Image.read(entry.get_input_stream.read) image.write will_be_write.path images.push({ width: image.width, height: image.height, src: will_be_write }) end end return images end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
komic-cli-0.1.7 | lib/komic/builder/zip.rb |
komic-cli-0.1.6 | lib/komic/builder/zip.rb |