Class: Hydra::Derivatives::PersistOutputFileService
- Inherits:
-
Object
- Object
- Hydra::Derivatives::PersistOutputFileService
- Defined in:
- lib/hydra/derivatives/services/persist_output_file_service.rb
Direct Known Subclasses
PersistBasicContainedOutputFileService, PersistExternalFileOutputFileService
Class Method Summary collapse
-
.call(_file_path, _directives) ⇒ Object
Persists the file within the object at destination_name.
- .determine_mime_type(file) ⇒ Object
- .determine_original_name(file) ⇒ Object
Class Method Details
.call(_file_path, _directives) ⇒ Object
Persists the file within the object at destination_name. Uses basic containment. If you want to use direct containment (ie. with PCDM) you must use a different service (ie. Hydra::Works::AddFileToGenericFile Service)
9 10 11 |
# File 'lib/hydra/derivatives/services/persist_output_file_service.rb', line 9 def self.call(_file_path, _directives) raise NotImplementedError, "PersistOutputFileService is an abstract class. Implement `call' on #{self.class.name}" end |
.determine_mime_type(file) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/hydra/derivatives/services/persist_output_file_service.rb', line 23 def self.determine_mime_type(file) if file.respond_to? :mime_type file.mime_type else "application/octet-stream" end end |
.determine_original_name(file) ⇒ Object
14 15 16 17 18 19 20 |
# File 'lib/hydra/derivatives/services/persist_output_file_service.rb', line 14 def self.determine_original_name(file) if file.respond_to? :original_filename file.original_filename else "derivative" end end |