Sha256: 565557c4e5172501a9c94688d66c97a1b8cf2262fa49fe26579faa7513cf6ad4

Contents?: true

Size: 1.05 KB

Versions: 4

Compression:

Stored size: 1.05 KB

Contents

module IIIFManifest
  module V3
    class ManifestFactory
      class << self
        def new(work, manifest_service_locator: ManifestServiceLocator)
          super(manifest_service_locator).new(work)
        end
      end

      delegate :collection_manifest_builder, :manifest_builder, :sammelband_manifest_builder,
               to: :manifest_service_locator
      attr_reader :manifest_service_locator

      def initialize(manifest_service_locator)
        @manifest_service_locator = manifest_service_locator
      end

      def new(work)
        if !work.work_presenters.empty?
          if sammelband?(work) || !work.file_set_presenters.empty?
            manifest_builder.new(work)
          elsif work.file_set_presenters.empty?
            work = IIIFManifest::IIIFCollection.new(work)
            collection_manifest_builder.new(work)
          end
        else
          manifest_builder.new(work)
        end
      end

      private

        def sammelband?(work)
          work.respond_to?(:sammelband?) && work.sammelband?
        end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
iiif_manifest-1.0.1 lib/iiif_manifest/v3/manifest_factory.rb
iiif_manifest-1.0.0 lib/iiif_manifest/v3/manifest_factory.rb
iiif_manifest-0.6.0 lib/iiif_manifest/v3/manifest_factory.rb
iiif_manifest-0.5.0 lib/iiif_manifest/v3/manifest_factory.rb