Class: PPStats::Summary
- Inherits:
-
Object
- Object
- PPStats::Summary
- Defined in:
- lib/pp-stats/summary.rb
Instance Method Summary collapse
-
#initialize(types, module_count, classes, defines) ⇒ Summary
constructor
A new instance of Summary.
- #print_summary_line(label, data) ⇒ Object
- #run ⇒ Object
Constructor Details
#initialize(types, module_count, classes, defines) ⇒ Summary
Returns a new instance of Summary.
3 4 5 6 7 8 |
# File 'lib/pp-stats/summary.rb', line 3 def initialize(types, module_count, classes, defines) @types = types @module_count = module_count @classes = classes @defines = defines end |
Instance Method Details
#print_summary_line(label, data) ⇒ Object
28 29 30 |
# File 'lib/pp-stats/summary.rb', line 28 def print_summary_line(label, data) printf " %-20s #{data}\n", label end |
#run ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pp-stats/summary.rb', line 10 def run puts PPStats::Format.cyan "-"*35 @types.each do |k,v| puts PPStats::Format.cyan k.to_s print_summary_line('files', v.counter.count[:files]) print_summary_line('lines', v.counter.count[:lines]) print_summary_line('max lines', "#{v.counter.count[:max_lines]} - #{v.counter.count[:max_file]}") print_summary_line('commented lines', v.counter.count[:commented_lines]) print_summary_line('most commented', "#{v.counter.count[:max_commented_lines]} - #{v.counter.count[:max_commented_file]}") print_summary_line('least commented', "#{v.counter.count[:floor_commented_lines]} - #{v.counter.count[:floor_commented_file]}") end puts PPStats::Format.cyan "-"*35 puts PPStats::Format.cyan "Totals" print_summary_line('modules', "#{@module_count}") print_summary_line('classes', "#{@classes}") print_summary_line('defines', "#{@defines}") end |