Class: Hyrax::Characterization::FileSetDescription

Inherits:
Object
  • Object
show all
Includes:
Hydra::Works::MimeTypes
Defined in:
app/services/hyrax/characterization/file_set_description.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_set:, primary_file: Hyrax::FileMetadata::Use::ORIGINAL_FILE) ⇒ FileSetDescription

Returns a new instance of FileSetDescription.

Parameters:

  • file_set (Hyrax::FileSet)
  • primary_file (RDF::URI, Symbol) (defaults to: Hyrax::FileMetadata::Use::ORIGINAL_FILE)

    the type of file_set member to use for characterization



21
22
23
24
25
26
# File 'app/services/hyrax/characterization/file_set_description.rb', line 21

def initialize(file_set:, primary_file: Hyrax::FileMetadata::Use::ORIGINAL_FILE)
  self.file_set = file_set

  @primary_file_type_uri =
    Hyrax::FileMetadata::Use.uri_for(use: primary_file)
end

Instance Attribute Details

#file_setHyrax::FileSet

Returns:



13
14
15
# File 'app/services/hyrax/characterization/file_set_description.rb', line 13

def file_set
  @file_set
end

Instance Method Details

#primary_fileHyrax::FileMetadata

Returns the member file to use for characterization.

Returns:



31
32
33
34
# File 'app/services/hyrax/characterization/file_set_description.rb', line 31

def primary_file
  queries.(resource: file_set, use: @primary_file_type_uri).first ||
    Hyrax::FileMetadata.new
end