Class: BPL::Derivatives::Runner
- Inherits:
-
Object
- Object
- BPL::Derivatives::Runner
- Defined in:
- lib/bpl/derivatives/runners/runner.rb
Direct Known Subclasses
AudioDerivatives, DocumentDerivatives, ImageDerivatives, Jpeg2kImageDerivatives, VideoDerivatives
Class Attribute Summary collapse
-
.output_file_service ⇒ Object
Use the output service configured for this class or default to the global setting.
-
.source_file_service ⇒ Object
Use the source service configured for this class or default to the global setting.
Class Method Summary collapse
- .create(object_or_filename, options) ⇒ Object
- .input_object(object_or_filename, options) ⇒ Object
- .processor_class ⇒ Object
- .source_file(object_or_filename, options, &block) ⇒ Object
-
.transform_directives(options) ⇒ Object
Override this method if you need to add any defaults.
Class Attribute Details
.output_file_service ⇒ Object
Use the output service configured for this class or default to the global setting
9 10 11 |
# File 'lib/bpl/derivatives/runners/runner.rb', line 9 def self.output_file_service @output_file_service || BPL::Derivatives.config.output_file_service end |
.source_file_service ⇒ Object
Use the source service configured for this class or default to the global setting
18 19 20 |
# File 'lib/bpl/derivatives/runners/runner.rb', line 18 def self.source_file_service @source_file_service || BPL::Derivatives.config.source_file_service end |
Class Method Details
.create(object_or_filename, options) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/bpl/derivatives/runners/runner.rb', line 25 def self.create(object_or_filename, ) io_object = input_object(object_or_filename, ) source_file(io_object, ) do |f| io_object.source_path = f.path transform_directives(.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) ⇒ Object
37 38 39 40 41 42 43 |
# File 'lib/bpl/derivatives/runners/runner.rb', line 37 def self.input_object(object_or_filename, ) if .key?(:source_datastream) return BPL::Derivatives::DatastreamDecorator.new(object_or_filename, .fetch(:source_datastream)) else return BPL::Derivatives::InputObjectDecorator.new(object_or_filename) end end |
.processor_class ⇒ Object
54 55 56 |
# 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) ⇒ Object
50 51 52 |
# File 'lib/bpl/derivatives/runners/runner.rb', line 50 def self.source_file(object_or_filename, , &block) source_file_service.call(object_or_filename, , &block) end |
.transform_directives(options) ⇒ Object
Override this method if you need to add any defaults
46 47 48 |
# File 'lib/bpl/derivatives/runners/runner.rb', line 46 def self.transform_directives() end |