Class: Riiif::ImageInformation
- Inherits:
-
Object
- Object
- Riiif::ImageInformation
- Extended by:
- Deprecation
- Defined in:
- app/models/riiif/image_information.rb
Overview
This is the result of calling the Riiif.image_info service. It stores the height & width
Instance Attribute Summary collapse
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #[](key) ⇒ Object
-
#initialize(width, height) ⇒ ImageInformation
constructor
A new instance of ImageInformation.
- #to_h ⇒ Object
-
#valid? ⇒ Boolean
Image information is only valid if height and width are present.
Constructor Details
#initialize(width, height) ⇒ ImageInformation
Returns a new instance of ImageInformation.
6 7 8 9 |
# File 'app/models/riiif/image_information.rb', line 6 def initialize(width, height) @width = width @height = height end |
Instance Attribute Details
#height ⇒ Object (readonly)
Returns the value of attribute height.
11 12 13 |
# File 'app/models/riiif/image_information.rb', line 11 def height @height end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
11 12 13 |
# File 'app/models/riiif/image_information.rb', line 11 def width @width end |
Instance Method Details
#==(other) ⇒ Object
31 32 33 34 35 |
# File 'app/models/riiif/image_information.rb', line 31 def ==(other) other.class == self.class && other.width == width && other.height == height end |
#[](key) ⇒ Object
17 18 19 |
# File 'app/models/riiif/image_information.rb', line 17 def [](key) to_h[key] end |
#to_h ⇒ Object
13 14 15 |
# File 'app/models/riiif/image_information.rb', line 13 def to_h { width: width, height: height } end |
#valid? ⇒ Boolean
Image information is only valid if height and width are present. If an image info service doesn’t have the value yet (not characterized perhaps?) then we wouldn’t want to cache this value.
27 28 29 |
# File 'app/models/riiif/image_information.rb', line 27 def valid? width.present? && height.present? end |