Class: SmartImage::RatioCalculator::Size
- Inherits:
-
Struct
- Object
- Struct
- SmartImage::RatioCalculator::Size
- Defined in:
- lib/smart_image/ratio_calculator.rb
Overview
Struct to hold the resulting size and compute aspect ratios
Instance Attribute Summary collapse
-
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio.
-
#height ⇒ Object
Returns the value of attribute height.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(width, height) ⇒ Size
constructor
A new instance of Size.
Constructor Details
#initialize(width, height) ⇒ Size
Returns a new instance of Size.
35 36 37 38 39 |
# File 'lib/smart_image/ratio_calculator.rb', line 35 def initialize(width, height) width, height = Integer(width), Integer(height) aspect_ratio = width.to_f / height super(width, height, aspect_ratio) end |
Instance Attribute Details
#aspect_ratio ⇒ Object
Returns the value of attribute aspect_ratio
34 35 36 |
# File 'lib/smart_image/ratio_calculator.rb', line 34 def aspect_ratio @aspect_ratio end |
#height ⇒ Object
Returns the value of attribute height
34 35 36 |
# File 'lib/smart_image/ratio_calculator.rb', line 34 def height @height end |
#width ⇒ Object
Returns the value of attribute width
34 35 36 |
# File 'lib/smart_image/ratio_calculator.rb', line 34 def width @width end |