Class: IIIFManifest::ManifestBuilder::ImageBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::ManifestBuilder::ImageBuilder
- Defined in:
- lib/iiif_manifest/manifest_builder/image_builder.rb
Instance Attribute Summary collapse
-
#display_image ⇒ Object
readonly
Returns the value of attribute display_image.
-
#iiif_annotation_factory ⇒ Object
readonly
Returns the value of attribute iiif_annotation_factory.
-
#resource_builder_factory ⇒ Object
readonly
Returns the value of attribute resource_builder_factory.
Instance Method Summary collapse
- #apply(canvas) ⇒ Object
-
#initialize(display_image, iiif_annotation_factory:, resource_builder_factory:) ⇒ ImageBuilder
constructor
A new instance of ImageBuilder.
Constructor Details
#initialize(display_image, iiif_annotation_factory:, resource_builder_factory:) ⇒ ImageBuilder
Returns a new instance of ImageBuilder.
5 6 7 8 9 10 |
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 5 def initialize(display_image, iiif_annotation_factory:, resource_builder_factory:) @display_image = display_image @iiif_annotation_factory = iiif_annotation_factory @resource_builder_factory = resource_builder_factory build_resource end |
Instance Attribute Details
#display_image ⇒ Object (readonly)
Returns the value of attribute display_image.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 4 def display_image @display_image end |
#iiif_annotation_factory ⇒ Object (readonly)
Returns the value of attribute iiif_annotation_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 4 def iiif_annotation_factory @iiif_annotation_factory end |
#resource_builder_factory ⇒ Object (readonly)
Returns the value of attribute resource_builder_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 4 def resource_builder_factory @resource_builder_factory end |
Instance Method Details
#apply(canvas) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/iiif_manifest/manifest_builder/image_builder.rb', line 12 def apply(canvas) annotation['on'] = canvas['@id'] canvas['width'] = annotation.resource['width'] canvas['height'] = annotation.resource['height'] canvas.images += [annotation] end |