class Hydra::Derivatives::Runner

Attributes

output_file_service[W]
source_file_service[W]

Public Class Methods

create(object_or_filename, options) click to toggle source

@param [String, ActiveFedora::Base] object_or_filename path to the source file, or an object @param [Hash] options options to pass to the encoder @options options [Array] :outputs a list of desired outputs, each entry is a hash that has :label (optional), :format and :url

# File lib/hydra/derivatives/runners/runner.rb, line 25
def self.create(object_or_filename, options)
  source_file(object_or_filename, options) do |f|
    transform_directives(options.delete(:outputs)).each do |instructions|
      processor_class.new(f.path,
                          instructions.merge(source_file_service: source_file_service),
                          output_file_service: output_file_service).process
    end
  end
end
output_file_service() click to toggle source

Use the output service configured for this class or default to the global setting

# File lib/hydra/derivatives/runners/runner.rb, line 9
def self.output_file_service
  @output_file_service || Hydra::Derivatives.output_file_service
end
processor_class() click to toggle source
# File lib/hydra/derivatives/runners/runner.rb, line 44
def self.processor_class
  raise "Overide the processor_class method in a sub class"
end
source_file(object_or_filename, options, &block) click to toggle source
# File lib/hydra/derivatives/runners/runner.rb, line 40
def self.source_file(object_or_filename, options, &block)
  source_file_service.call(object_or_filename, options, &block)
end
source_file_service() click to toggle source

Use the source service configured for this class or default to the global setting

# File lib/hydra/derivatives/runners/runner.rb, line 18
def self.source_file_service
  @source_file_service || Hydra::Derivatives.source_file_service
end
transform_directives(options) click to toggle source

Override this method if you need to add any defaults

# File lib/hydra/derivatives/runners/runner.rb, line 36
def self.transform_directives(options)
  options
end