Class: Ddr::Derivatives::Generator Abstract
- Inherits:
-
Object
- Object
- Ddr::Derivatives::Generator
- Defined in:
- lib/ddr/derivatives/generator.rb
Overview
This class is abstract.
Direct Known Subclasses
Defined Under Namespace
Classes: GeneratorResult
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
-
#output ⇒ Object
readonly
Returns the value of attribute output.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
-
.output_mime_type ⇒ Object
The mime type of the output generated.
Instance Method Summary collapse
-
#generate ⇒ Object
The actions required to generate the output from the source.
-
#initialize(source, output, options = nil) ⇒ Generator
constructor
A new instance of Generator.
Constructor Details
#initialize(source, output, options = nil) ⇒ Generator
Returns a new instance of Generator.
10 11 12 13 14 15 16 |
# File 'lib/ddr/derivatives/generator.rb', line 10 def initialize source, output, =nil raise ArgumentError, "Source must be a File or path to a file" unless Ddr::Utils.file_or_path?(source) raise ArgumentError, "Output must be a File or path to a file" unless Ddr::Utils.file_or_path?(output) @source = source @output = output @options = end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
6 7 8 |
# File 'lib/ddr/derivatives/generator.rb', line 6 def @options end |
#output ⇒ Object (readonly)
Returns the value of attribute output.
6 7 8 |
# File 'lib/ddr/derivatives/generator.rb', line 6 def output @output end |
#source ⇒ Object (readonly)
Returns the value of attribute source.
6 7 8 |
# File 'lib/ddr/derivatives/generator.rb', line 6 def source @source end |
Class Method Details
.output_mime_type ⇒ Object
The mime type of the output generated. Implemented in each subclass.
20 21 22 |
# File 'lib/ddr/derivatives/generator.rb', line 20 def self.output_mime_type raise NotImplementedError end |
Instance Method Details
#generate ⇒ Object
The actions required to generate the output from the source. Implemented in each subclass.
26 27 28 |
# File 'lib/ddr/derivatives/generator.rb', line 26 def generate raise NotImplementedError end |