Class: IIIFManifest::V3::ManifestBuilder::AnnotationContentBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::V3::ManifestBuilder::AnnotationContentBuilder
- Defined in:
- lib/iiif_manifest/v3/manifest_builder/annotation_content_builder.rb
Instance Attribute Summary collapse
-
#annotation_content ⇒ Object
readonly
Returns the value of attribute annotation_content.
-
#body_builder_factory ⇒ Object
readonly
Returns the value of attribute body_builder_factory.
-
#iiif_annotation_factory ⇒ Object
readonly
Returns the value of attribute iiif_annotation_factory.
Instance Method Summary collapse
- #apply(canvas) ⇒ Object
-
#initialize(annotation_content, iiif_annotation_factory:, body_builder_factory:) ⇒ AnnotationContentBuilder
constructor
A new instance of AnnotationContentBuilder.
Constructor Details
#initialize(annotation_content, iiif_annotation_factory:, body_builder_factory:) ⇒ AnnotationContentBuilder
Returns a new instance of AnnotationContentBuilder.
6 7 8 9 10 11 |
# File 'lib/iiif_manifest/v3/manifest_builder/annotation_content_builder.rb', line 6 def initialize(annotation_content, iiif_annotation_factory:, body_builder_factory:) @annotation_content = annotation_content @iiif_annotation_factory = iiif_annotation_factory @body_builder_factory = body_builder_factory build_annotation_resource end |
Instance Attribute Details
#annotation_content ⇒ Object (readonly)
Returns the value of attribute annotation_content.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/annotation_content_builder.rb', line 5 def annotation_content @annotation_content end |
#body_builder_factory ⇒ Object (readonly)
Returns the value of attribute body_builder_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/annotation_content_builder.rb', line 5 def body_builder_factory @body_builder_factory end |
#iiif_annotation_factory ⇒ Object (readonly)
Returns the value of attribute iiif_annotation_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/annotation_content_builder.rb', line 5 def iiif_annotation_factory @iiif_annotation_factory end |
Instance Method Details
#apply(canvas) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/iiif_manifest/v3/manifest_builder/annotation_content_builder.rb', line 13 def apply(canvas) # Assume first item in canvas annotations is an annotation page canvas_id = canvas.annotations.first['id'] generic_annotation['id'] = annotation_id(canvas_id) generic_annotation['target'] = target(canvas) generic_annotation['motivation'] = motivation generic_annotation end |