Class: Hydra::Derivatives::Processors::ActiveEncode

Inherits:
Processor
  • Object
show all
Defined in:
lib/hydra/derivatives/processors/active_encode.rb

Instance Attribute Summary collapse

Attributes inherited from Processor

#directives, #output_file_service, #source_path

Instance Method Summary collapse

Methods inherited from Processor

#output_file, #output_file_id, #output_filename_for

Constructor Details

#initialize(source_path, directives, opts = {}) ⇒ ActiveEncode


17
18
19
20
# File 'lib/hydra/derivatives/processors/active_encode.rb', line 17

def initialize(source_path, directives, opts = {})
  super
  @encode_class = opts.delete(:encode_class) || ::ActiveEncode::Base
end

Instance Attribute Details

#encode_classObject

Returns the value of attribute encode_class


14
15
16
# File 'lib/hydra/derivatives/processors/active_encode.rb', line 14

def encode_class
  @encode_class
end

#encode_jobObject (readonly)

Returns the value of attribute encode_job


15
16
17
# File 'lib/hydra/derivatives/processors/active_encode.rb', line 15

def encode_job
  @encode_job
end

Instance Method Details

#processObject


22
23
24
25
26
27
28
# File 'lib/hydra/derivatives/processors/active_encode.rb', line 22

def process
  @encode_job = encode_class.create(source_path, directives)
  timeout ? wait_for_encode_job_with_timeout : wait_for_encode_job
  encode_job.output.each do |output|
    output_file_service.call(output, directives)
  end
end