Class: ImageMosaic::Image::Mosaic

Inherits:
Object
  • Object
show all
Defined in:
lib/image_mosaic/image/mosaic.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ Mosaic

Returns a new instance of Mosaic.



6
7
8
9
# File 'lib/image_mosaic/image/mosaic.rb', line 6

def initialize(image)
  @image = image
  @securerandom = SecureRandom.uuid
end

Instance Attribute Details

#imageObject (readonly)

Returns the value of attribute image.



4
5
6
# File 'lib/image_mosaic/image/mosaic.rb', line 4

def image
  @image
end

Instance Method Details

#filenameObject



15
16
17
# File 'lib/image_mosaic/image/mosaic.rb', line 15

def filename
  "mosaic_#{@securerandom}.png"
end

#saveObject



11
12
13
# File 'lib/image_mosaic/image/mosaic.rb', line 11

def save
  @image.write(filename)
end