Sha256: 34dd04f2c93efc4a5b84ea804e1a26bf2ac900d7f075887d4ad4f7e5ce346c8a

Contents?: true

Size: 763 Bytes

Versions: 2

Compression:

Stored size: 763 Bytes

Contents

require 'tempfile'
require 'komic/utils'
require 'zip'

module Komic::Builder
  class Directory
    attr_reader :images

    def initialize(type_string, options)
      @options = options
      @path = File.join(Dir.pwd, type_string)
    end

    def images
      images = []
      Dir.glob(File.join(@path, FNMATCH_FOR_IMAGE)).
        sort_by { |x| File.basename(x).split('.')[0].to_i }.
        each_with_index do |entry_path, index|
          will_be_write = Tempfile.new("#{ File.basename(entry_path) }")
          image = MiniMagick::Image.open(entry_path)
          image.write will_be_write.path
          images.push({
            width: image.width, height: image.height, src: will_be_write
          })
        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/directory.rb
komic-cli-0.1.6 lib/komic/builder/directory.rb