Sha256: 7918e7e6079c0f0c61070ff8b9350f93fdf5a1268077b460b4deead5ba298613

Contents?: true

Size: 822 Bytes

Versions: 1

Compression:

Stored size: 822 Bytes

Contents

require "image_mosaic/version"
require 'mini_magick'
require 'tempfile'
require 'securerandom'
require 'image_mosaic/operations/compositor'
require 'image_mosaic/data/setting'
require 'image_mosaic/data/validator'
require 'image_mosaic/image/parent'
require 'image_mosaic/image/child'

module ImageMosaic
  HEIGHT = 1000
  WIDTH = 1000

  class Construct
    def initialize(items)
      @items = items
    end

    def save
      parent.write("#{SecureRandom.uuid}.png")
    end

    private

    def parent
      @parent ||= Image::Parent.new(valid_items, colour: 'white', columns: setting.columns, dimension: setting.dimension).create
    end

    def setting
      @setting ||= Data::Setting.new(valid_items.count)
    end

    def valid_items
      @valid_items ||= Data::Validator.new(@items).items
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
image_mosaic-0.1.1 lib/image_mosaic.rb