Class: IIIFManifest::ManifestBuilder::CompositeBuilder

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*services) ⇒ CompositeBuilder

Returns a new instance of CompositeBuilder.



6
7
8
# File 'lib/iiif_manifest/manifest_builder/composite_builder.rb', line 6

def initialize(*services)
  @services = services.compact
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth_name, *args, &block) ⇒ Object



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

def method_missing(meth_name, *args, &block)
  services.map do |service|
    service.__send__(meth_name, *args, &block)
  end
end

Instance Attribute Details

#servicesObject (readonly)

Returns the value of attribute services.



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

def services
  @services
end

Instance Method Details

#apply(manifest) ⇒ Object



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

def apply(manifest)
  services.each do |service|
    manifest = service.apply(manifest)
  end
  manifest
end