Class: IIIFManifest::ManifestBuilder::StructureBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::ManifestBuilder::StructureBuilder
- Defined in:
- lib/iiif_manifest/manifest_builder/structure_builder.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#canvas_builder_factory ⇒ Object
readonly
Returns the value of attribute canvas_builder_factory.
-
#iiif_range_factory ⇒ Object
readonly
Returns the value of attribute iiif_range_factory.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
- #apply(manifest) ⇒ Object
-
#initialize(record, canvas_builder_factory:, iiif_range_factory:) ⇒ StructureBuilder
constructor
A new instance of StructureBuilder.
- #range_builder(top_range) ⇒ Object
- #top_ranges ⇒ Object
Constructor Details
#initialize(record, canvas_builder_factory:, iiif_range_factory:) ⇒ StructureBuilder
Returns a new instance of StructureBuilder.
5 6 7 8 9 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 5 def initialize(record, canvas_builder_factory:, iiif_range_factory:) @record = record @canvas_builder_factory = canvas_builder_factory @iiif_range_factory = iiif_range_factory end |
Instance Attribute Details
#canvas_builder_factory ⇒ Object (readonly)
Returns the value of attribute canvas_builder_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 4 def canvas_builder_factory @canvas_builder_factory end |
#iiif_range_factory ⇒ Object (readonly)
Returns the value of attribute iiif_range_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 4 def iiif_range_factory @iiif_range_factory end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 4 def record @record end |
Instance Method Details
#apply(manifest) ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 11 def apply(manifest) top_ranges.each do |top_range| manifest['structures'] ||= [] manifest['structures'] = range_builder(top_range).apply(manifest['structures']) end manifest end |
#range_builder(top_range) ⇒ Object
19 20 21 22 23 24 25 26 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 19 def range_builder(top_range) RangeBuilder.new( top_range, record, true, canvas_builder_factory: canvas_builder_factory, iiif_range_factory: iiif_range_factory ) end |
#top_ranges ⇒ Object
28 29 30 |
# File 'lib/iiif_manifest/manifest_builder/structure_builder.rb', line 28 def top_ranges record.try(:ranges) || [] end |