Class: RubyCritic::Generator::Html::SmellsIndex

Inherits:
Base
  • Object
show all
Defined in:
lib/rubycritic/generators/html/smells_index.rb

Constant Summary collapse

TEMPLATE =
erb_template('smells_index.html.erb')

Constants inherited from Base

Base::LAYOUT_TEMPLATE, Base::TEMPLATES_DIR

Instance Method Summary collapse

Methods inherited from Base

erb_template, #file_directory, #file_href, #file_pathname

Methods included from ViewHelpers

#asset_path, #code_index_path, #file_path, #smell_location_path, #timeago_tag

Constructor Details

#initialize(analysed_modules) ⇒ SmellsIndex

Returns a new instance of SmellsIndex.



11
12
13
14
15
16
# File 'lib/rubycritic/generators/html/smells_index.rb', line 11

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

Instance Method Details

#file_nameObject



24
25
26
# File 'lib/rubycritic/generators/html/smells_index.rb', line 24

def file_name
  'smells_index.html'
end

#renderObject



28
29
30
31
# File 'lib/rubycritic/generators/html/smells_index.rb', line 28

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


18
19
20
21
22
# File 'lib/rubycritic/generators/html/smells_index.rb', line 18

def set_header_links
  @base_path = code_index_path(Config.base_root_directory, file_name)
  @feature_path = code_index_path(Config.feature_root_directory, file_name)
  @build_path = code_index_path(Config.compare_root_directory, file_name)
end