Class: CodeStatistics
Instance Method Summary collapse
-
#initialize(*pairs) ⇒ CodeStatistics
constructor
A new instance of CodeStatistics.
- #to_s ⇒ Object
Constructor Details
#initialize(*pairs) ⇒ CodeStatistics
Returns a new instance of CodeStatistics.
2 3 4 5 6 |
# File 'lib/code_statistics.rb', line 2 def initialize(*pairs) @pairs = pairs @statistics = calculate_statistics @total = calculate_total if pairs.length > 1 end |
Instance Method Details
#to_s ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/code_statistics.rb', line 8 def to_s print_header @pairs.each { |pair| print_line(pair.first, @statistics[pair.first]) } print_splitter if @total print_line("Total", @total) print_splitter end print_code_test_stats end |