Sha256: 7ef5e24b83d0112b45e5d0e4d9203163bc2a96b81689b9d325e252bfd894818e
Contents?: true
Size: 921 Bytes
Versions: 4
Compression:
Stored size: 921 Bytes
Contents
module IIIFManifest class ManifestBuilder class CanvasBuilder attr_reader :record, :parent def initialize(record, parent) @record = record @parent = parent apply_record_properties attach_image if display_image end def canvas @canvas ||= IIIF::Presentation::Canvas.new end def path "#{parent.manifest_url}/canvas/#{record.id}" end def apply(sequence) return sequence if canvas.images.blank? sequence.canvases += [canvas] sequence end private def display_image record.display_image if record.respond_to?(:display_image) end def apply_record_properties canvas['@id'] = path canvas.label = record.to_s end def attach_image ImageBuilder.new(display_image).apply(canvas) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems