Class: IIIF::Image::Size::Percent
- Inherits:
-
Object
- Object
- IIIF::Image::Size::Percent
- Defined in:
- lib/iiif/image/size/percent.rb
Overview
The width and height of the returned image is scaled to n% of the width and height of the extracted region. The aspect ratio of the returned image is the same as that of the extracted region.
Instance Attribute Summary collapse
-
#percentage ⇒ Object
readonly
Returns the value of attribute percentage.
Instance Method Summary collapse
-
#initialize(percentage) ⇒ Percent
constructor
A new instance of Percent.
-
#scale ⇒ Float
Scale factor between 0 and 1.
- #to_s ⇒ Object
Constructor Details
#initialize(percentage) ⇒ Percent
Returns a new instance of Percent.
8 9 10 |
# File 'lib/iiif/image/size/percent.rb', line 8 def initialize(percentage) @percentage = percentage end |
Instance Attribute Details
#percentage ⇒ Object (readonly)
Returns the value of attribute percentage.
12 13 14 |
# File 'lib/iiif/image/size/percent.rb', line 12 def percentage @percentage end |
Instance Method Details
#scale ⇒ Float
Returns scale factor between 0 and 1.
15 16 17 |
# File 'lib/iiif/image/size/percent.rb', line 15 def scale percentage / 100 end |
#to_s ⇒ Object
19 20 21 |
# File 'lib/iiif/image/size/percent.rb', line 19 def to_s "pct:#{percentage}" end |