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_filename_for

Constructor Details

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

Returns a new instance of ActiveEncode.



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

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.



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

def encode_class
  @encode_class
end

#encode_jobObject (readonly)

Returns the value of attribute encode_job.



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

def encode_job
  @encode_job
end

Instance Method Details

#processObject



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

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