class Hydra::Derivatives::PersistOutputFileService
Public Class Methods
call(_file_path, _directives)
click to toggle source
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) @param [String] file_path the path to the file to be added @param [Hash] directives directions which can be used to determine where to persist to. @option directives [String] url This can determine the path of the object.
# 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)
click to toggle source
@param file [Hydra::Derivatives::IoDecorator]
# File lib/hydra/derivatives/services/persist_output_file_service.rb, line 22 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)
click to toggle source
@param file [Hydra::Derivatives::IoDecorator]
# File lib/hydra/derivatives/services/persist_output_file_service.rb, line 13 def self.determine_original_name(file) if file.respond_to? :original_filename file.original_filename else "derivative" end end