Class: IIIF::Image::Size::BestFit

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

Overview

The image content is scaled for the best fit such that the resulting width and height are less than or equal to the requested width and height.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(width, height) ⇒ BestFit

Returns a new instance of BestFit.

Parameters:

  • width (Integer)
  • height (Integer)


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

def initialize(width, height)
  @width = width
  @height = height
end

Instance Attribute Details

#heightObject (readonly)

Returns the value of attribute height.



13
14
15
# File 'lib/iiif/image/size/best_fit.rb', line 13

def height
  @height
end

#widthObject (readonly)

Returns the value of attribute width.



13
14
15
# File 'lib/iiif/image/size/best_fit.rb', line 13

def width
  @width
end

Instance Method Details

#to_sObject



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

def to_s
  "!#{width},#{height}"
end