Class: IIIFManifest::V3::ManifestBuilder::ThumbnailBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::V3::ManifestBuilder::ThumbnailBuilder
- Defined in:
- lib/iiif_manifest/v3/manifest_builder/thumbnail_builder.rb
Instance Attribute Summary collapse
-
#display_content ⇒ Object
readonly
Returns the value of attribute display_content.
-
#iiif_thumbnail_factory ⇒ Object
readonly
Returns the value of attribute iiif_thumbnail_factory.
-
#image_service_builder_factory ⇒ Object
readonly
Returns the value of attribute image_service_builder_factory.
Instance Method Summary collapse
- #build ⇒ Array<Object>
-
#initialize(display_content, iiif_thumbnail_factory:, image_service_builder_factory:) ⇒ ThumbnailBuilder
constructor
A new instance of ThumbnailBuilder.
Constructor Details
#initialize(display_content, iiif_thumbnail_factory:, image_service_builder_factory:) ⇒ ThumbnailBuilder
Returns a new instance of ThumbnailBuilder.
6 7 8 9 10 |
# File 'lib/iiif_manifest/v3/manifest_builder/thumbnail_builder.rb', line 6 def initialize(display_content, iiif_thumbnail_factory:, image_service_builder_factory:) @display_content = display_content @iiif_thumbnail_factory = iiif_thumbnail_factory @image_service_builder_factory = image_service_builder_factory end |
Instance Attribute Details
#display_content ⇒ Object (readonly)
Returns the value of attribute display_content.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/thumbnail_builder.rb', line 5 def display_content @display_content end |
#iiif_thumbnail_factory ⇒ Object (readonly)
Returns the value of attribute iiif_thumbnail_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/thumbnail_builder.rb', line 5 def iiif_thumbnail_factory @iiif_thumbnail_factory end |
#image_service_builder_factory ⇒ Object (readonly)
Returns the value of attribute image_service_builder_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/thumbnail_builder.rb', line 5 def image_service_builder_factory @image_service_builder_factory end |
Instance Method Details
#build ⇒ Array<Object>
13 14 15 16 17 18 19 20 |
# File 'lib/iiif_manifest/v3/manifest_builder/thumbnail_builder.rb', line 13 def build return Array(display_content.thumbnail.map(&:stringify_keys)) unless display_content.thumbnail.nil? return nil if display_content.type != "Image" || iiif_endpoint.nil? build_thumbnail image_service_builder.apply(thumbnail) [thumbnail] end |