class BPL::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/bpl/derivatives/runners/runner.rb, line 25 def self.create(object_or_filename, options) io_object = input_object(object_or_filename, options) source_file(io_object, options) do |f| io_object.source_path = f.path transform_directives(options.delete(:outputs)).each do |instructions| processor_class.new(io_object, instructions.merge(source_file_service: source_file_service), output_file_service: output_file_service).process end end end
input_object(object_or_filename, options)
click to toggle source
# File lib/bpl/derivatives/runners/runner.rb, line 37 def self.input_object(object_or_filename, options) if options.key?(:source_datastream) return BPL::Derivatives::DatastreamDecorator.new(object_or_filename, options.fetch(:source_datastream)) else return BPL::Derivatives::InputObjectDecorator.new(object_or_filename) 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/bpl/derivatives/runners/runner.rb, line 9 def self.output_file_service @output_file_service || BPL::Derivatives.config.output_file_service end
processor_class()
click to toggle source
# File lib/bpl/derivatives/runners/runner.rb, line 54 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/bpl/derivatives/runners/runner.rb, line 50 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/bpl/derivatives/runners/runner.rb, line 18 def self.source_file_service @source_file_service || BPL::Derivatives.config.source_file_service end
transform_directives(options)
click to toggle source
Override this method if you need to add any defaults
# File lib/bpl/derivatives/runners/runner.rb, line 46 def self.transform_directives(options) options end