Class: SdrClient::RedesignedClient::StructuralMetadataBuilder
- Inherits:
-
Object
- Object
- SdrClient::RedesignedClient::StructuralMetadataBuilder
- Defined in:
- lib/sdr_client/redesigned_client/structural_metadata_builder.rb
Overview
Build basic metadata for files, iterating over a series of operations The available options are here: github.com/sul-dlss/sdr-client/blob/v0.8.1/lib/sdr_client/deposit/file.rb#L8-L10
Class Method Summary collapse
-
.build(files:, files_metadata:, basepath:) ⇒ Hash<String, Hash<String, String>>
A map of relative filepaths to a map of metadata.
Instance Method Summary collapse
-
#build ⇒ Hash<String, Hash<String, String>>
A map of relative filepaths to a map of metadata.
-
#initialize(files:, files_metadata:, basepath:) ⇒ StructuralMetadataBuilder
constructor
A new instance of StructuralMetadataBuilder.
Constructor Details
#initialize(files:, files_metadata:, basepath:) ⇒ StructuralMetadataBuilder
Returns a new instance of StructuralMetadataBuilder.
22 23 24 25 26 |
# File 'lib/sdr_client/redesigned_client/structural_metadata_builder.rb', line 22 def initialize(files:, files_metadata:, basepath:) @files = files @files_metadata = @basepath = basepath end |
Class Method Details
.build(files:, files_metadata:, basepath:) ⇒ Hash<String, Hash<String, String>>
Returns a map of relative filepaths to a map of metadata.
17 18 19 |
# File 'lib/sdr_client/redesigned_client/structural_metadata_builder.rb', line 17 def self.build(files:, files_metadata:, basepath:) new(files: files, files_metadata: .dup, basepath: basepath).build end |
Instance Method Details
#build ⇒ Hash<String, Hash<String, String>>
Returns a map of relative filepaths to a map of metadata.
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sdr_client/redesigned_client/structural_metadata_builder.rb', line 29 def build files.each do |filepath| OPERATIONS.each do |operation| result = operation.for(filepath: absolute_filepath_for(filepath)) next if result.nil? [filepath] ||= {} [filepath][operation::NAME] = result end end end |