Class: IIIF::Image::Transformation
- Inherits:
-
Object
- Object
- IIIF::Image::Transformation
- Defined in:
- lib/iiif/image/models/transformation.rb
Overview
A data object that describes the IIIF request
Instance Attribute Summary collapse
-
#format ⇒ Object
readonly
Returns the value of attribute format.
-
#quality ⇒ Object
readonly
Returns the value of attribute quality.
-
#region ⇒ Object
readonly
Returns the value of attribute region.
-
#rotation ⇒ Object
readonly
Returns the value of attribute rotation.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(region:, size:, rotation: '0', quality: 'default', format: 'jpg') ⇒ Transformation
constructor
A new instance of Transformation.
- #to_params ⇒ Object
- #valid? ⇒ Boolean
Constructor Details
#initialize(region:, size:, rotation: '0', quality: 'default', format: 'jpg') ⇒ Transformation
Returns a new instance of Transformation.
6 7 8 9 10 11 12 |
# File 'lib/iiif/image/models/transformation.rb', line 6 def initialize(region:, size:, rotation: '0', quality: 'default', format: 'jpg') @region = region @size = size @rotation = rotation @quality = quality @format = format end |
Instance Attribute Details
#format ⇒ Object (readonly)
Returns the value of attribute format.
14 15 16 |
# File 'lib/iiif/image/models/transformation.rb', line 14 def format @format end |
#quality ⇒ Object (readonly)
Returns the value of attribute quality.
14 15 16 |
# File 'lib/iiif/image/models/transformation.rb', line 14 def quality @quality end |
#region ⇒ Object (readonly)
Returns the value of attribute region.
14 15 16 |
# File 'lib/iiif/image/models/transformation.rb', line 14 def region @region end |
#rotation ⇒ Object (readonly)
Returns the value of attribute rotation.
14 15 16 |
# File 'lib/iiif/image/models/transformation.rb', line 14 def rotation @rotation end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
14 15 16 |
# File 'lib/iiif/image/models/transformation.rb', line 14 def size @size end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 32 33 34 35 |
# File 'lib/iiif/image/models/transformation.rb', line 28 def ==(other) other.class == self.class && other.region == region && other.size == size && other.rotation == rotation && other.quality == quality && other.format == format end |
#to_params ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/iiif/image/models/transformation.rb', line 16 def to_params { region: region, size: size, rotation: rotation, quality: quality, format: format } end |
#valid? ⇒ Boolean
24 25 26 |
# File 'lib/iiif/image/models/transformation.rb', line 24 def valid? %w(color gray bitonal default).include? quality end |