Sha256: 026063d331c7d77564ba616fa668898f5b42738de0638d411a3be07a03bf6471

Contents?: true

Size: 916 Bytes

Versions: 1

Compression:

Stored size: 916 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

1 entries across 1 versions & 1 rubygems

Version Path
rubycritic-2.9.3 lib/rubycritic/generators/html/smells_index.rb