Class: Hydra::Derivatives::ActiveEncodeDerivatives

Inherits:
Runner
  • Object
show all
Defined in:
lib/hydra/derivatives/runners/active_encode_derivatives.rb

Class Method Summary collapse

Methods inherited from Runner

source_file, transform_directives

Class Method Details

.create(object_or_filename, options) ⇒ Object

Parameters:

  • object_or_filename (String, ActiveFedora::Base)

    source file name (or path), or an object that has a method that will return the file name

  • options (Hash)

    options to pass to the encoder

Options Hash (options):

  • :source (Symbol)

    a method that can be called on the object to retrieve the source file's name

  • :encode_class (Symbol)

    class name of the encode object (usually a subclass of ::ActiveEncode::Base)


8
9
10
11
12
13
14
15
16
# File 'lib/hydra/derivatives/runners/active_encode_derivatives.rb', line 8

def self.create(object_or_filename, options)
  processor_opts = processor_options(options)
  source_file(object_or_filename, options) do |file_name|
    transform_directives(options.delete(:outputs)).each do |instructions|
      processor = processor_class.new(file_name, instructions, processor_opts)
      processor.process
    end
  end
end

.output_file_serviceObject

Use the output service configured for this class or default to the external file service


24
25
26
# File 'lib/hydra/derivatives/runners/active_encode_derivatives.rb', line 24

def self.output_file_service
  @output_file_service || PersistExternalFileOutputFileService
end

.processor_classObject


28
29
30
# File 'lib/hydra/derivatives/runners/active_encode_derivatives.rb', line 28

def self.processor_class
  Processors::ActiveEncode
end

.source_file_serviceObject

Use the source service configured for this class or default to the remote file service


19
20
21
# File 'lib/hydra/derivatives/runners/active_encode_derivatives.rb', line 19

def self.source_file_service
  @source_file_service || RemoteSourceFile
end