Class: PhotoCook::Resize::MagickPhoto
- Inherits:
-
MiniMagick::Image
- Object
- MiniMagick::Image
- PhotoCook::Resize::MagickPhoto
- Defined in:
- lib/photo-cook/resize/magick-photo.rb
Instance Attribute Summary collapse
-
#calculated_height ⇒ Object
Returns the value of attribute calculated_height.
-
#calculated_width ⇒ Object
Returns the value of attribute calculated_width.
-
#desired_height ⇒ Object
Returns the value of attribute desired_height.
-
#desired_width ⇒ Object
Returns the value of attribute desired_width.
-
#max_height ⇒ Object
readonly
Returns the value of attribute max_height.
-
#max_width ⇒ Object
readonly
Returns the value of attribute max_width.
-
#resize_mode ⇒ Object
Returns the value of attribute resize_mode.
-
#source_path ⇒ Object
Returns the value of attribute source_path.
-
#store_path ⇒ Object
Returns the value of attribute store_path.
Instance Method Summary collapse
- #calculated_aspect_ratio ⇒ Object
- #desired_aspect_ratio ⇒ Object
-
#initialize ⇒ MagickPhoto
constructor
A new instance of MagickPhoto.
Constructor Details
#initialize ⇒ MagickPhoto
Returns a new instance of MagickPhoto.
21 22 23 24 25 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 21 def initialize(*) super @max_width = self[:width] @max_height = self[:height] end |
Instance Attribute Details
#calculated_height ⇒ Object
Returns the value of attribute calculated_height.
14 15 16 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 14 def calculated_height @calculated_height end |
#calculated_width ⇒ Object
Returns the value of attribute calculated_width.
13 14 15 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 13 def calculated_width @calculated_width end |
#desired_height ⇒ Object
Returns the value of attribute desired_height.
11 12 13 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 11 def desired_height @desired_height end |
#desired_width ⇒ Object
Returns the value of attribute desired_width.
10 11 12 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 10 def desired_width @desired_width end |
#max_height ⇒ Object (readonly)
Returns the value of attribute max_height.
19 20 21 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 19 def max_height @max_height end |
#max_width ⇒ Object (readonly)
Returns the value of attribute max_width.
18 19 20 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 18 def max_width @max_width end |
#resize_mode ⇒ Object
Returns the value of attribute resize_mode.
16 17 18 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 16 def resize_mode @resize_mode end |
#source_path ⇒ Object
Returns the value of attribute source_path.
7 8 9 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 7 def source_path @source_path end |
#store_path ⇒ Object
Returns the value of attribute store_path.
8 9 10 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 8 def store_path @store_path end |
Instance Method Details
#calculated_aspect_ratio ⇒ Object
31 32 33 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 31 def calculated_aspect_ratio calculated_width / calculated_height.to_f end |
#desired_aspect_ratio ⇒ Object
27 28 29 |
# File 'lib/photo-cook/resize/magick-photo.rb', line 27 def desired_aspect_ratio desired_width / desired_height.to_f end |