Class: Assembly::ContentMetadata
- Inherits:
-
Object
- Object
- Assembly::ContentMetadata
- Defined in:
- lib/assembly-objectfile/content_metadata.rb,
lib/assembly-objectfile/content_metadata/file.rb,
lib/assembly-objectfile/content_metadata/config.rb,
lib/assembly-objectfile/content_metadata/file_set.rb,
lib/assembly-objectfile/content_metadata/file_set_builder.rb,
lib/assembly-objectfile/content_metadata/nokogiri_builder.rb
Overview
This class generates content metadata for image files
Defined Under Namespace
Modules: Types Classes: Config, File, FileSet, FileSetBuilder, NokogiriBuilder
Class Method Summary collapse
-
.create_content_metadata(druid:, objects:, auto_labels: true, add_exif: false, bundle: :default, style: :simple_image, add_file_attributes: false, file_attributes: {}, preserve_common_paths: false, flatten_folder_structure: false, include_root_xml: nil, reading_order: 'ltr') ⇒ Object
Generates image content XML metadata for a repository object.
- .object_level_type(style) ⇒ Object
- .special_dpg_folder?(folder) ⇒ Boolean
Class Method Details
.create_content_metadata(druid:, objects:, auto_labels: true, add_exif: false, bundle: :default, style: :simple_image, add_file_attributes: false, file_attributes: {}, preserve_common_paths: false, flatten_folder_structure: false, include_root_xml: nil, reading_order: 'ltr') ⇒ Object
Generates image content XML metadata for a repository object. This method only produces content metadata for images and does not depend on a specific folder structure. Note that it is class level method.
Example:
Assembly::ContentMetadata.(:druid=>'druid:nx288wh8889',:style=>:simple_image,:objects=>object_files,:add_file_attributes=>false)
59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 |
# File 'lib/assembly-objectfile/content_metadata.rb', line 59 def self.(druid:, objects:, auto_labels: true, add_exif: false, bundle: :default, style: :simple_image, add_file_attributes: false, file_attributes: {}, preserve_common_paths: false, flatten_folder_structure: false, include_root_xml: nil, reading_order: 'ltr') common_path = find_common_path(objects) unless preserve_common_paths # find common paths to all files provided if needed filesets = FileSetBuilder.build(bundle: bundle, objects: objects, style: style) config = Config.new(auto_labels: auto_labels, flatten_folder_structure: flatten_folder_structure, add_file_attributes: add_file_attributes, file_attributes: file_attributes, add_exif: add_exif, reading_order: reading_order, type: object_level_type(style)) builder = NokogiriBuilder.build(druid: druid, filesets: filesets, common_path: common_path, config: config) if include_root_xml == false builder.doc.root.to_xml else builder.to_xml end end |
.object_level_type(style) ⇒ Object
103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/assembly-objectfile/content_metadata.rb', line 103 def self.object_level_type(style) Deprecation.warn(self, "the style #{style} is now deprecated and should not be used. This will be removed in assembly-objectfile 2.0") if DEPRECATED_STYLES.include? style raise "Supplied style (#{style}) not valid" unless (VALID_STYLES + DEPRECATED_STYLES).include? style case style when :simple_image 'image' when :simple_book, :book_with_pdf, :book_as_image 'book' else style.to_s end end |
.special_dpg_folder?(folder) ⇒ Boolean
88 89 90 |
# File 'lib/assembly-objectfile/content_metadata.rb', line 88 def self.special_dpg_folder?(folder) SPECIAL_DPG_FOLDERS.include?(folder) end |