Sha256: 3c078f51d6d170a643bfc66a784955a95a8544d3df5e9b590997b503003090e0

Contents?: true

Size: 700 Bytes

Versions: 1

Compression:

Stored size: 700 Bytes

Contents

require "erb"
require "rubycritic/report_generators/base_generator"

module Rubycritic

  class CodeIndexGenerator < BaseGenerator
    TEMPLATE = erb_template("code_index.html.erb")

    def initialize(source_pathnames, smelly_pathnames)
      @source_pathnames = source_pathnames
      @smelly_pathnames = smelly_pathnames
    end

    def file_name
      "code_index.html"
    end

    def render
      index_body = TEMPLATE.result(get_binding)
      LAYOUT_TEMPLATE.result(get_binding { index_body })
    end

    def file_path(path)
      File.join(root_directory, path.sub_ext(".html"))
    end

    def smells_count(pathname)
      (@smelly_pathnames[pathname] || []).length
    end
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
rubycritic-0.0.12 lib/rubycritic/report_generators/code_index_generator.rb