Class: Hydra::Derivatives::PersistOutputFileService
- Inherits:
-
Object
- Object
- Hydra::Derivatives::PersistOutputFileService
show all
- Defined in:
- lib/hydra/derivatives/services/persist_output_file_service.rb
Class Method Summary
collapse
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)
8
9
10
|
# File 'lib/hydra/derivatives/services/persist_output_file_service.rb', line 8
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
20
21
22
23
24
25
26
|
# File 'lib/hydra/derivatives/services/persist_output_file_service.rb', line 20
def self.determine_mime_type(file)
if file.respond_to? :mime_type
file.mime_type
else
"appliction/octet-stream"
end
end
|
.determine_original_name(file) ⇒ Object
12
13
14
15
16
17
18
|
# File 'lib/hydra/derivatives/services/persist_output_file_service.rb', line 12
def self.determine_original_name(file)
if file.respond_to? :original_name
file.original_name
else
"derivative"
end
end
|