Class: IIIF::Image::Size::Width
- Inherits:
-
Object
- Object
- IIIF::Image::Size::Width
- Defined in:
- lib/iiif/image/size/width.rb
Overview
The image or region should be scaled so that its width is exactly equal to the provided parameter, and the height will be a calculated value that maintains the aspect ratio of the extracted region
Instance Attribute Summary collapse
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #height_for_aspect_ratio(ratio) ⇒ Object
-
#initialize(width) ⇒ Width
constructor
A new instance of Width.
- #to_s ⇒ Object
Constructor Details
#initialize(width) ⇒ Width
Returns a new instance of Width.
8 9 10 |
# File 'lib/iiif/image/size/width.rb', line 8 def initialize(width) @width = width end |
Instance Attribute Details
#width ⇒ Object (readonly)
Returns the value of attribute width.
12 13 14 |
# File 'lib/iiif/image/size/width.rb', line 12 def width @width end |
Instance Method Details
#height_for_aspect_ratio(ratio) ⇒ Object
15 16 17 |
# File 'lib/iiif/image/size/width.rb', line 15 def height_for_aspect_ratio(ratio) (width / ratio).round end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/iiif/image/size/width.rb', line 19 def to_s "#{width}," end |