Class: RubyCritic::Generator::Html::Overview

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

Constant Summary collapse

TEMPLATE =
erb_template('overview.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) ⇒ Overview

Returns a new instance of Overview.


13
14
15
16
17
18
19
# File 'lib/rubycritic/generators/html/overview.rb', line 13

def initialize(analysed_modules)
  @turbulence_data = Turbulence.data(analysed_modules)
  @score = analysed_modules.score
  @max_score = AnalysedModulesCollection::MAX_SCORE
  @summary = analysed_modules.summary
  set_header_links if Config.compare_branches_mode?
end

Instance Method Details

#file_nameObject


27
28
29
# File 'lib/rubycritic/generators/html/overview.rb', line 27

def file_name
  'overview.html'
end

#renderObject


31
32
33
34
# File 'lib/rubycritic/generators/html/overview.rb', line 31

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

21
22
23
24
25
# File 'lib/rubycritic/generators/html/overview.rb', line 21

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