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, #file_path, #javascript_tag, #smell_location_path, #stylesheet_path, #timeago_tag

Constructor Details

#initialize(analysed_modules) ⇒ SmellsIndex

Returns a new instance of SmellsIndex.



9
10
11
12
13
# File 'lib/rubycritic/generators/html/smells_index.rb', line 9

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

Instance Method Details

#file_nameObject



15
16
17
# File 'lib/rubycritic/generators/html/smells_index.rb', line 15

def file_name
  'smells_index.html'
end

#renderObject



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

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