Class: Assembly::ContentMetadata::FileSetBuilder
- Inherits:
-
Object
- Object
- Assembly::ContentMetadata::FileSetBuilder
- Defined in:
- lib/assembly-objectfile/content_metadata/file_set_builder.rb
Overview
Builds a groups of related Files, based on bundle
Class Method Summary collapse
Instance Method Summary collapse
-
#build ⇒ Array<FileSet>
A list of filesets in the object.
-
#initialize(bundle:, objects:, style:) ⇒ FileSetBuilder
constructor
A new instance of FileSetBuilder.
Constructor Details
#initialize(bundle:, objects:, style:) ⇒ FileSetBuilder
Returns a new instance of FileSetBuilder.
14 15 16 17 18 |
# File 'lib/assembly-objectfile/content_metadata/file_set_builder.rb', line 14 def initialize(bundle:, objects:, style:) @bundle = bundle @objects = objects @style = style end |
Class Method Details
.build(bundle:, objects:, style:) ⇒ Object
10 11 12 |
# File 'lib/assembly-objectfile/content_metadata/file_set_builder.rb', line 10 def self.build(bundle:, objects:, style:) new(bundle: bundle, objects: objects, style: style).build end |
Instance Method Details
#build ⇒ Array<FileSet>
Returns a list of filesets in the object.
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/assembly-objectfile/content_metadata/file_set_builder.rb', line 21 def build case bundle when :default # one resource per object objects.collect { |obj| FileSet.new(resource_files: [obj], style: style) } when :filename # one resource per distinct filename (excluding extension) build_for_filename when :dpg # group by DPG filename build_for_dpg when :prebundled # if the user specifies this method, they will pass in an array of arrays, indicating resources, so we don't need to bundle in the gem # This is used by the assemblyWF if you have stubContentMetadata.xml objects.map { |inner| FileSet.new(resource_files: inner, style: style) } else raise 'Invalid bundle method' end end |