Class: IIIFManifest::ManifestBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_manifest/manifest_builder.rb,
lib/iiif_manifest/manifest_builder/iiif_service.rb,
lib/iiif_manifest/manifest_builder/image_builder.rb,
lib/iiif_manifest/manifest_builder/canvas_builder.rb,
lib/iiif_manifest/manifest_builder/resource_builder.rb,
lib/iiif_manifest/manifest_builder/sequence_builder.rb,
lib/iiif_manifest/manifest_builder/composite_builder.rb,
lib/iiif_manifest/manifest_builder/structure_builder.rb,
lib/iiif_manifest/manifest_builder/image_service_builder.rb,
lib/iiif_manifest/manifest_builder/canvas_builder_factory.rb,
lib/iiif_manifest/manifest_builder/record_property_builder.rb,
lib/iiif_manifest/manifest_builder/composite_builder_factory.rb,
lib/iiif_manifest/manifest_builder/deep_canvas_builder_factory.rb,
lib/iiif_manifest/manifest_builder/child_manifest_builder_factory.rb

Defined Under Namespace

Classes: CanvasBuilder, CanvasBuilderFactory, ChildManifestBuilderFactory, CompositeBuilder, CompositeBuilderFactory, DeepCanvasBuilderFactory, DeepFileSetEnumerator, IIIFManifest, IIIFService, ImageBuilder, ImageServiceBuilder, RangeBuilder, RecordPropertyBuilder, ResourceBuilder, SequenceBuilder, StructureBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(work, builders:, top_record_factory:) ⇒ ManifestBuilder

Returns a new instance of ManifestBuilder.



20
21
22
23
24
# File 'lib/iiif_manifest/manifest_builder.rb', line 20

def initialize(work, builders:, top_record_factory:)
  @work = work
  @builders = builders
  @top_record_factory = top_record_factory
end

Instance Attribute Details

#buildersObject (readonly)

Returns the value of attribute builders.



17
18
19
# File 'lib/iiif_manifest/manifest_builder.rb', line 17

def builders
  @builders
end

#top_record_factoryObject (readonly)

Returns the value of attribute top_record_factory.



17
18
19
# File 'lib/iiif_manifest/manifest_builder.rb', line 17

def top_record_factory
  @top_record_factory
end

#workObject (readonly)

Returns the value of attribute work.



17
18
19
# File 'lib/iiif_manifest/manifest_builder.rb', line 17

def work
  @work
end

Instance Method Details

#apply(collection) ⇒ Object



26
27
28
29
30
# File 'lib/iiif_manifest/manifest_builder.rb', line 26

def apply(collection)
  collection['manifests'] ||= []
  collection['manifests'] << to_h
  collection
end

#to_hObject



32
33
34
# File 'lib/iiif_manifest/manifest_builder.rb', line 32

def to_h
  @to_h ||= builders.new(work).apply(top_record)
end