class Hydra::Derivatives::Processors::Processor
Processors
take a single input and produce a single output
Attributes
directives[RW]
output_file_service[RW]
source_path[RW]
Public Class Methods
new(source_path, directives, opts = {})
click to toggle source
@param [String] source_path
path to the file on disk @param [Hash] directives directions for creating the output @option [String] :format the format of the output @option [String] :url the location to put the output @param [Hash] opts @option [#call] :output_file_service An output file service to call
# File lib/hydra/derivatives/processors/processor.rb, line 12 def initialize(source_path, directives, opts = {}) self.source_path = source_path self.directives = directives self.output_file_service = opts.fetch(:output_file_service, Hydra::Derivatives.output_file_service) end
Public Instance Methods
output_file()
click to toggle source
@deprecated Please use a PersistOutputFileService
class to save an object
# File lib/hydra/derivatives/processors/processor.rb, line 27 def output_file raise NotImplementedError, "Processor is an abstract class. Utilize an implementation of a PersistOutputFileService class in #{self.class.name}" end
output_filename_for(_name)
click to toggle source
# File lib/hydra/derivatives/processors/processor.rb, line 22 def output_filename_for(_name) File.basename(source_path) end
process()
click to toggle source
# File lib/hydra/derivatives/processors/processor.rb, line 18 def process raise "Processor is an abstract class. Implement `process' on #{self.class.name}" end