Class: IIIFManifest::ManifestBuilder::SequenceBuilder

Inherits:
Object
  • Object
show all
Defined in:
lib/iiif_manifest/manifest_builder/sequence_builder.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(work, canvas_builder_factory:, sequence_factory:) ⇒ SequenceBuilder

Returns a new instance of SequenceBuilder.



5
6
7
8
9
# File 'lib/iiif_manifest/manifest_builder/sequence_builder.rb', line 5

def initialize(work, canvas_builder_factory:, sequence_factory:)
  @work = work
  @canvas_builder_factory = canvas_builder_factory
  @sequence_factory = sequence_factory
end

Instance Attribute Details

#canvas_builder_factoryObject (readonly)

Returns the value of attribute canvas_builder_factory.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/sequence_builder.rb', line 4

def canvas_builder_factory
  @canvas_builder_factory
end

#sequence_factoryObject (readonly)

Returns the value of attribute sequence_factory.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/sequence_builder.rb', line 4

def sequence_factory
  @sequence_factory
end

#workObject (readonly)

Returns the value of attribute work.



4
5
6
# File 'lib/iiif_manifest/manifest_builder/sequence_builder.rb', line 4

def work
  @work
end

Instance Method Details

#apply(manifest) ⇒ Object



11
12
13
14
15
# File 'lib/iiif_manifest/manifest_builder/sequence_builder.rb', line 11

def apply(manifest)
  # sequence.viewing_hint = manifest.viewing_hint
  manifest.sequences += [sequence] unless empty?
  manifest
end

#empty?Boolean

Returns:

  • (Boolean)


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

def empty?
  sequence.canvases.empty?
end