Sha256: 0fb670f97ff0cdd50acdf1996bf248834f3cf7e8a72d2f4734f9e3f5f3b1ef07

Contents?: true

Size: 960 Bytes

Versions: 3

Compression:

Stored size: 960 Bytes

Contents

require "erb"
require "rubycritic/report_generators/view_helpers"

module Rubycritic
  module Generator

    class Base
      def self.erb_template(template_path)
        ERB.new(File.read(File.join(TEMPLATES_DIR, template_path)))
      end

      TEMPLATES_DIR = File.expand_path("../templates", __FILE__)
      LAYOUT_TEMPLATE = erb_template(File.join("layouts", "application.html.erb"))

      include ViewHelpers

      def file_href
        "file://#{file_pathname}"
      end

      def file_pathname
        File.join(file_directory, file_name)
      end

      def file_directory
        root_directory
      end

      def file_name
        raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
      end

      def render
        raise NotImplementedError.new("The #{self.class} class must implement the #{__method__} method.")
      end

      def get_binding
        binding
      end
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
rubycritic-0.0.15 lib/rubycritic/report_generators/base.rb
rubycritic-0.0.14 lib/rubycritic/report_generators/base.rb
rubycritic-0.0.13 lib/rubycritic/report_generators/base.rb