Sha256: f7971734400100d5b4b813a15c08d4253c65373ec64e936ab681468511c7d57e

Contents?: true

Size: 887 Bytes

Versions: 63

Compression:

Stored size: 887 Bytes

Contents

module Ddr
  module Derivatives
    # @abstract
    class Generator

      attr_reader :source, :output, :options

      GeneratorResult = Struct.new(:stdout, :stderr, :status)

      def initialize source, output, options=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 = options
      end

      # The mime type of the output generated.
      # Implemented in each subclass.
      def self.output_mime_type
        raise NotImplementedError
      end

      # The actions required to generate the output from the source.
      # Implemented in each subclass.
      def generate
        raise NotImplementedError
      end
    end
  end
end

Version data entries

63 entries across 63 versions & 1 rubygems

Version Path
ddr-models-2.0.0.rc6 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.rc5 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.rc4 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.rc3 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.rc2 lib/ddr/derivatives/generator.rb
ddr-models-1.17.1 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.rc1 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.pre.5 lib/ddr/derivatives/generator.rb
ddr-models-1.17.0 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.pre.4 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.pre.3 lib/ddr/derivatives/generator.rb
ddr-models-1.16.2 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.pre.2 lib/ddr/derivatives/generator.rb
ddr-models-2.0.0.pre.1 lib/ddr/derivatives/generator.rb
ddr-models-1.16.1 lib/ddr/derivatives/generator.rb
ddr-models-1.16.0 lib/ddr/derivatives/generator.rb
ddr-models-1.15.0 lib/ddr/derivatives/generator.rb
ddr-models-1.14.2 lib/ddr/derivatives/generator.rb
ddr-models-1.14.1 lib/ddr/derivatives/generator.rb
ddr-models-1.14.0 lib/ddr/derivatives/generator.rb