Class: Hydra::Derivatives::Processor
- Inherits:
-
Object
- Object
- Hydra::Derivatives::Processor
- Defined in:
- lib/hydra/derivatives/processor.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#object ⇒ Object
Returns the value of attribute object.
-
#output_file_service ⇒ Object
Returns the value of attribute output_file_service.
-
#source_file_service ⇒ Object
Returns the value of attribute source_file_service.
-
#source_name ⇒ Object
Returns the value of attribute source_name.
Instance Method Summary collapse
-
#initialize(obj, source_name, directives, opts = {}) ⇒ Processor
constructor
A new instance of Processor.
-
#output_file ⇒ Object
deprecated
Deprecated.
Please use a PersistOutputFileService class to save an object
- #output_file_id(name) ⇒ Object
- #process ⇒ Object
- #source_file ⇒ Object
Constructor Details
#initialize(obj, source_name, directives, opts = {}) ⇒ Processor
6 7 8 9 10 11 12 |
# File 'lib/hydra/derivatives/processor.rb', line 6 def initialize(obj, source_name, directives, opts={}) self.object = obj self.source_name = source_name self.directives = directives self.source_file_service = opts.fetch(:source_file_service, Hydra::Derivatives.source_file_service) 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/processor.rb', line 4 def directives @directives end |
#object ⇒ Object
Returns the value of attribute object.
4 5 6 |
# File 'lib/hydra/derivatives/processor.rb', line 4 def object @object end |
#output_file_service ⇒ Object
Returns the value of attribute output_file_service.
4 5 6 |
# File 'lib/hydra/derivatives/processor.rb', line 4 def output_file_service @output_file_service end |
#source_file_service ⇒ Object
Returns the value of attribute source_file_service.
4 5 6 |
# File 'lib/hydra/derivatives/processor.rb', line 4 def source_file_service @source_file_service end |
#source_name ⇒ Object
Returns the value of attribute source_name.
4 5 6 |
# File 'lib/hydra/derivatives/processor.rb', line 4 def source_name @source_name end |
Instance Method Details
#output_file ⇒ Object
Deprecated.
Please use a PersistOutputFileService class to save an object
23 24 25 |
# File 'lib/hydra/derivatives/processor.rb', line 23 def output_file raise NotImplementedError, "Processor is an abstract class. Utilize an implementation of a PersistOutputFileService class in #{self.class.name}" end |
#output_file_id(name) ⇒ Object
18 19 20 |
# File 'lib/hydra/derivatives/processor.rb', line 18 def output_file_id(name) [source_name, name].join('_') end |
#process ⇒ Object
14 15 16 |
# File 'lib/hydra/derivatives/processor.rb', line 14 def process raise "Processor is an abstract class. Implement `process' on #{self.class.name}" end |
#source_file ⇒ Object
27 28 29 |
# File 'lib/hydra/derivatives/processor.rb', line 27 def source_file @source_file ||= source_file_service.call(object, source_name) end |