Class: Hydra::Derivatives::Processors::Processor
- Inherits:
-
Object
- Object
- Hydra::Derivatives::Processors::Processor
- Defined in:
- lib/hydra/derivatives/processors/processor.rb
Overview
Processors take a single input and produce a single output
Direct Known Subclasses
ActiveEncode, Audio, Document, FullText, Image, Jpeg2kImage, Video::Processor
Instance Attribute Summary collapse
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#output_file_service ⇒ Object
Returns the value of attribute output_file_service.
-
#source_path ⇒ Object
Returns the value of attribute source_path.
Instance Method Summary collapse
-
#initialize(source_path, directives, opts = {}) ⇒ Processor
constructor
A new instance of Processor.
-
#output_file ⇒ Object
deprecated
Deprecated.
Please use a PersistOutputFileService class to save an object
- #output_filename_for(_name) ⇒ Object
- #process ⇒ Object
Constructor Details
#initialize(source_path, directives, opts = {}) ⇒ Processor
Returns a new instance of Processor.
12 13 14 15 16 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 12 def initialize(source_path, directives, opts = {}) self.source_path = source_path self.directives = directives self.output_file_service = opts.fetch(:output_file_service, Hydra::Derivatives.output_file_service) end |
Instance Attribute Details
#directives ⇒ Object
Returns the value of attribute directives.
4 5 6 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 4 def directives @directives end |
#output_file_service ⇒ Object
Returns the value of attribute output_file_service.
4 5 6 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 4 def output_file_service @output_file_service end |
#source_path ⇒ Object
Returns the value of attribute source_path.
4 5 6 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 4 def source_path @source_path end |
Instance Method Details
#output_file ⇒ Object
Deprecated.
Please use a PersistOutputFileService class to save an object
27 28 29 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 27 def output_file raise NotImplementedError, "Processor is an abstract class. Utilize an implementation of a PersistOutputFileService class in #{self.class.name}" end |
#output_filename_for(_name) ⇒ Object
22 23 24 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 22 def output_filename_for(_name) File.basename(source_path) end |
#process ⇒ Object
18 19 20 |
# File 'lib/hydra/derivatives/processors/processor.rb', line 18 def process raise "Processor is an abstract class. Implement `process' on #{self.class.name}" end |