Class: IIIF::Image::Size::Height

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif/image/size/height.rb

Overview

The image or region should be scaled so that its height is exactly equal to the provided parameter, and the width will be a calculated value that maintains the aspect ratio of the extracted region

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(height) ⇒ Height

Returns a new instance of Height.

Parameters:

  • height (Integer)


8
9
10
# File 'lib/iiif/image/size/height.rb', line 8

def initialize(height)
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



12
13
14
# File 'lib/iiif/image/size/height.rb', line 12

def height
  @height
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/iiif/image/size/height.rb', line 19

def to_s
  ",#{height}"
end

#width_for_aspect_ratio(ratio) ⇒ Object

Parameters:

  • ratio (Rational)

    the aspect ratio



15
16
17
# File 'lib/iiif/image/size/height.rb', line 15

def width_for_aspect_ratio(ratio)
  (ratio * height).round
end