Class: IIIFManifest::V3::ManifestBuilder::ChoiceBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::V3::ManifestBuilder::ChoiceBuilder
- Defined in:
- lib/iiif_manifest/v3/manifest_builder/choice_builder.rb
Instance Attribute Summary collapse
-
#body_builder_factory ⇒ Object
readonly
Returns the value of attribute body_builder_factory.
-
#display_content ⇒ Object
readonly
Returns the value of attribute display_content.
-
#iiif_annotation_factory ⇒ Object
readonly
Returns the value of attribute iiif_annotation_factory.
-
#iiif_choice_factory ⇒ Object
readonly
Returns the value of attribute iiif_choice_factory.
Instance Method Summary collapse
- #apply(canvas) ⇒ Object
-
#initialize(display_content, iiif_annotation_factory:, body_builder_factory:, iiif_choice_factory:) ⇒ ChoiceBuilder
constructor
A new instance of ChoiceBuilder.
Constructor Details
#initialize(display_content, iiif_annotation_factory:, body_builder_factory:, iiif_choice_factory:) ⇒ ChoiceBuilder
Returns a new instance of ChoiceBuilder.
6 7 8 9 10 11 12 |
# File 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb', line 6 def initialize(display_content, iiif_annotation_factory:, body_builder_factory:, iiif_choice_factory:) @display_content = display_content @iiif_annotation_factory = iiif_annotation_factory @body_builder_factory = body_builder_factory @iiif_choice_factory = iiif_choice_factory build_choice end |
Instance Attribute Details
#body_builder_factory ⇒ Object (readonly)
Returns the value of attribute body_builder_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb', line 5 def body_builder_factory @body_builder_factory end |
#display_content ⇒ Object (readonly)
Returns the value of attribute display_content.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb', line 5 def display_content @display_content end |
#iiif_annotation_factory ⇒ Object (readonly)
Returns the value of attribute iiif_annotation_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb', line 5 def iiif_annotation_factory @iiif_annotation_factory end |
#iiif_choice_factory ⇒ Object (readonly)
Returns the value of attribute iiif_choice_factory.
5 6 7 |
# File 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb', line 5 def iiif_choice_factory @iiif_choice_factory end |
Instance Method Details
#apply(canvas) ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/iiif_manifest/v3/manifest_builder/choice_builder.rb', line 14 def apply(canvas) # Assume first item in canvas is an annotation page annotation['id'] = "#{canvas.items.first['id']}/annotation/#{annotation.index}" annotation['target'] = canvas['id'] canvas['width'] = choice.items.first['width'] canvas['height'] = choice.items.first['height'] canvas['duration'] = choice.items.first['duration'] annotation.body = choice canvas.items.first.items += [annotation] end |