Class: Motion::IconGenerator::Image
- Inherits:
-
Object
- Object
- Motion::IconGenerator::Image
- Includes:
- Magick
- Defined in:
- lib/motion/icon_generator/image.rb
Instance Attribute Summary collapse
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
-
#initialize(size) ⇒ Image
constructor
Create a new Image.
-
#report ⇒ Object
Prints feedback to STDOUT.
-
#write! ⇒ Object
Writes this image to disk.
Constructor Details
#initialize(size) ⇒ Image
Create a new Image
size - An ImageSize to specifcy the size and name of image.
15 16 17 |
# File 'lib/motion/icon_generator/image.rb', line 15 def initialize(size) @size = size end |
Instance Attribute Details
#size ⇒ Object (readonly)
Returns the value of attribute size.
9 10 11 |
# File 'lib/motion/icon_generator/image.rb', line 9 def size @size end |
Instance Method Details
#report ⇒ Object
Prints feedback to STDOUT
26 27 28 29 30 31 32 |
# File 'lib/motion/icon_generator/image.rb', line 26 def report if File.exist?(filename) puts("Created #{filename.ljust(50)}\t(#{size.actual_width}x#{size.actual_height})") else warn("Couldn't write #{filename}") end end |
#write! ⇒ Object
Writes this image to disk
20 21 22 23 |
# File 'lib/motion/icon_generator/image.rb', line 20 def write! create_target_directory scaled_image.write(filename) end |