Class: Skunk::Generator::Console::Simple
- Inherits:
-
Object
- Object
- Skunk::Generator::Console::Simple
- Defined in:
- lib/skunk/generators/console/simple.rb
Overview
Generates a console report for the analysed modules.
Constant Summary collapse
- HEADINGS =
%w[file skunk_score churn_times_cost churn cost coverage].freeze
- HEADINGS_WITHOUT_FILE =
HEADINGS - %w[file]
- HEADINGS_WITHOUT_FILE_WIDTH =
padding
HEADINGS_WITHOUT_FILE.size * 17
- TEMPLATE =
ERB.new(" <%= _ttable %>\n\n SkunkScore Total: <%= total_skunk_score %>\n Modules Analysed: <%= analysed_modules_count %>\n SkunkScore Average: <%= skunk_score_average %>\n <% if worst %>Worst SkunkScore: <%= worst.skunk_score %> (<%= worst.pathname %>)<% end %>\n\n Generated with Skunk v<%= Skunk::VERSION %>\n TEMPL\n)\n"
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(analysed_modules) ⇒ Simple
constructor
A new instance of Simple.
- #render ⇒ Object
Constructor Details
#initialize(analysed_modules) ⇒ Simple
Returns a new instance of Simple.
11 12 13 |
# File 'lib/skunk/generators/console/simple.rb', line 11 def initialize(analysed_modules) @analysed_modules = analysed_modules end |
Class Method Details
.format_hash_row(file_hash) ⇒ Object
79 80 81 82 83 84 85 86 87 88 |
# File 'lib/skunk/generators/console/simple.rb', line 79 def self.format_hash_row(file_hash) [ file_hash[:file], file_hash[:skunk_score], file_hash[:churn_times_cost], file_hash[:churn], file_hash[:cost], file_hash[:coverage] ] end |
Instance Method Details
#render ⇒ Object
31 32 33 34 35 |
# File 'lib/skunk/generators/console/simple.rb', line 31 def render opts = .merge(headings: HEADINGS, rows: table) _ttable = Terminal::Table.new(opts) TEMPLATE.result(binding) end |