Sha256: f57ff4a9091a012f3f48095c5de36d11bcd128bf90a7f05b14dbac404177076b

Contents?: true

Size: 797 Bytes

Versions: 2

Compression:

Stored size: 797 Bytes

Contents

# coding: utf-8

module Thinreports
  module Generator

    # @abstract
    class Base
      # @return [Thinreports::Report::Base]
      attr_reader :report

      # @return [Hash]
      attr_reader :options

      def self.inherited(g)
        Generator.register(g.name.split('::').last.downcase.to_sym, g);
      end

      # @param [Thinreports::Report::Base] report
      # @param [Hash] options
      def initialize(report, options = {})
        report.finalize

        @report  = report.internal
        @options = options || {}
      end

      # @param [String, nil] filename
      # @return [String, nil]
      # @abstract
      def generate(filename = nil)
        raise NotImplementedError
      end

      def default_layout
        report.default_layout
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
thinreports-0.8.1 lib/thinreports/generator/base.rb
thinreports-0.8.0 lib/thinreports/generator/base.rb