Class: Rubycritic::CodeIndexGenerator
- Inherits:
-
BaseGenerator
- Object
- BaseGenerator
- Rubycritic::CodeIndexGenerator
- Defined in:
- lib/rubycritic/report_generators/code_index_generator.rb
Constant Summary collapse
- TEMPLATE =
erb_template("code_index.html.erb")
Constants inherited from BaseGenerator
BaseGenerator::LAYOUT_TEMPLATE, BaseGenerator::TEMPLATES_DIR
Instance Method Summary collapse
- #file_name ⇒ Object
- #file_path(path) ⇒ Object
-
#initialize(source_pathnames, smelly_pathnames) ⇒ CodeIndexGenerator
constructor
A new instance of CodeIndexGenerator.
- #render ⇒ Object
- #smells_count(pathname) ⇒ Object
Methods inherited from BaseGenerator
erb_template, #file_directory, #file_href, #file_pathname, #get_binding
Methods included from ViewHelpers
#analysed_file_name, #asset_path, #code_index_path, #javascript_path, #overview_path, #root_directory, #smell_location_path, #smells_index_path, #stylesheet_path
Constructor Details
#initialize(source_pathnames, smelly_pathnames) ⇒ CodeIndexGenerator
Returns a new instance of CodeIndexGenerator.
9 10 11 12 |
# File 'lib/rubycritic/report_generators/code_index_generator.rb', line 9 def initialize(source_pathnames, smelly_pathnames) @source_pathnames = source_pathnames @smelly_pathnames = smelly_pathnames end |
Instance Method Details
#file_name ⇒ Object
14 15 16 |
# File 'lib/rubycritic/report_generators/code_index_generator.rb', line 14 def file_name "code_index.html" end |
#file_path(path) ⇒ Object
23 24 25 |
# File 'lib/rubycritic/report_generators/code_index_generator.rb', line 23 def file_path(path) File.join(root_directory, path.sub_ext(".html")) end |
#render ⇒ Object
18 19 20 21 |
# File 'lib/rubycritic/report_generators/code_index_generator.rb', line 18 def render index_body = TEMPLATE.result(get_binding) LAYOUT_TEMPLATE.result(get_binding { index_body }) end |
#smells_count(pathname) ⇒ Object
27 28 29 |
# File 'lib/rubycritic/report_generators/code_index_generator.rb', line 27 def smells_count(pathname) (@smelly_pathnames[pathname] || []).length end |