Sha256: a510de604159d60bbb246c9bf06245e090f167f6d36e551bd647ee1e6c5bd4c8

Contents?: true

Size: 918 Bytes

Versions: 9

Compression:

Stored size: 918 Bytes

Contents

require "rubycritic/generators/html/base"

module Rubycritic
  module Generator
    module Html

      class SmellsIndex < Base
        TEMPLATE = erb_template("smells_index.html.erb")

        def initialize(analysed_modules)
          @smells = analysed_modules.flat_map(&:smells).uniq
          @analysed_module_names = analysed_module_names(analysed_modules)
          @show_status = (Config.mode == :default)
        end

        def file_name
          "smells_index.html"
        end

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

        private

        def analysed_module_names(analysed_modules)
          names = {}
          analysed_modules.each do |analysed_module|
            names[analysed_module.pathname] = analysed_module.name
          end
          names
        end
      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rubycritic-2.6.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.5.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.4.1 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.4.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.3.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.2.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.1.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-2.0.0 lib/rubycritic/generators/html/smells_index.rb
rubycritic-1.4.0 lib/rubycritic/generators/html/smells_index.rb