Class: IIIFManifest::ManifestBuilder::CanvasBuilder
- Inherits:
-
Object
- Object
- IIIFManifest::ManifestBuilder::CanvasBuilder
- Defined in:
- lib/iiif_manifest/manifest_builder/canvas_builder.rb
Instance Attribute Summary collapse
-
#iiif_canvas_factory ⇒ Object
readonly
Returns the value of attribute iiif_canvas_factory.
-
#image_builder ⇒ Object
readonly
Returns the value of attribute image_builder.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
Instance Method Summary collapse
- #apply(sequence) ⇒ Object
- #canvas ⇒ Object
-
#initialize(record, parent, iiif_canvas_factory:, image_builder:) ⇒ CanvasBuilder
constructor
A new instance of CanvasBuilder.
- #path ⇒ Object
Constructor Details
#initialize(record, parent, iiif_canvas_factory:, image_builder:) ⇒ CanvasBuilder
Returns a new instance of CanvasBuilder.
6 7 8 9 10 11 12 13 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 6 def initialize(record, parent, iiif_canvas_factory:, image_builder:) @record = record @parent = parent @iiif_canvas_factory = iiif_canvas_factory @image_builder = image_builder apply_record_properties attach_image if display_image end |
Instance Attribute Details
#iiif_canvas_factory ⇒ Object (readonly)
Returns the value of attribute iiif_canvas_factory.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 4 def iiif_canvas_factory @iiif_canvas_factory end |
#image_builder ⇒ Object (readonly)
Returns the value of attribute image_builder.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 4 def image_builder @image_builder end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 4 def parent @parent end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
4 5 6 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 4 def record @record end |
Instance Method Details
#apply(sequence) ⇒ Object
23 24 25 26 27 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 23 def apply(sequence) return sequence if canvas.images.blank? sequence.canvases += [canvas] sequence end |
#canvas ⇒ Object
15 16 17 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 15 def canvas @canvas ||= iiif_canvas_factory.new end |
#path ⇒ Object
19 20 21 |
# File 'lib/iiif_manifest/manifest_builder/canvas_builder.rb', line 19 def path "#{parent.manifest_url}/canvas/#{record.id}" end |