Sha256: 667ca6469656a8a5da6e9c6e053da1c839f9639a1c4f3755395429be8a2028ab

Contents?: true

Size: 717 Bytes

Versions: 2

Compression:

Stored size: 717 Bytes

Contents

module Riiif
  # This is the result of calling the Riiif.image_info service. It stores the height & width
  class ImageInformation
    def initialize(width, height)
      @width = width
      @height = height
    end

    attr_reader :width, :height

    def to_h
      { width: width, height: height }
    end

    # 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.
    def valid?
      width.present? && height.present?
    end

    def ==(other)
      other.class == self.class &&
        other.width == width &&
        other.height == height
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
riiif-1.5.0 app/models/riiif/image_information.rb
riiif-1.4.4 app/models/riiif/image_information.rb