Class: IIIFManifest::ManifestBuilder::ResourceBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::ManifestBuilder::ResourceBuilder
- Defined in:
- lib/iiif_manifest/manifest_builder/resource_builder.rb
Instance Attribute Summary collapse
-
#display_image ⇒ Object
readonly
Returns the value of attribute display_image.
-
#iiif_resource_factory ⇒ Object
readonly
Returns the value of attribute iiif_resource_factory.
-
#image_service_builder_factory ⇒ Object
readonly
Returns the value of attribute image_service_builder_factory.
Instance Method Summary collapse
- #apply(annotation) ⇒ Object
-
#initialize(display_image, iiif_resource_factory:, image_service_builder_factory:) ⇒ ResourceBuilder
constructor
A new instance of ResourceBuilder.
Constructor Details
#initialize(display_image, iiif_resource_factory:, image_service_builder_factory:) ⇒ ResourceBuilder
Returns a new instance of ResourceBuilder.
5 6 7 8 9 |
# File 'lib/iiif_manifest/manifest_builder/resource_builder.rb', line 5 def initialize(display_image, iiif_resource_factory:, image_service_builder_factory:) @display_image = display_image @iiif_resource_factory = iiif_resource_factory @image_service_builder_factory = image_service_builder_factory end |
Instance Attribute Details
#display_image ⇒ Object (readonly)
Returns the value of attribute display_image.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/resource_builder.rb', line 4 def display_image @display_image end |
#iiif_resource_factory ⇒ Object (readonly)
Returns the value of attribute iiif_resource_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/resource_builder.rb', line 4 def iiif_resource_factory @iiif_resource_factory end |
#image_service_builder_factory ⇒ Object (readonly)
Returns the value of attribute image_service_builder_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/resource_builder.rb', line 4 def image_service_builder_factory @image_service_builder_factory end |
Instance Method Details
#apply(annotation) ⇒ Object
11 12 13 14 15 16 17 18 19 |
# File 'lib/iiif_manifest/manifest_builder/resource_builder.rb', line 11 def apply(annotation) resource['@id'] = display_image.url resource['@type'] = 'dctypes:Image' resource['height'] = display_image.height resource['width'] = display_image.width resource['format'] = display_image.format image_service_builder.apply(resource) if iiif_endpoint annotation.resource = resource end |