Class: Transpec::Report
- Inherits:
-
Object
- Object
- Transpec::Report
- Defined in:
- lib/transpec/report.rb
Instance Attribute Summary collapse
-
#context_errors ⇒ Object
readonly
Returns the value of attribute context_errors.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
-
#syntax_errors ⇒ Object
readonly
Returns the value of attribute syntax_errors.
Instance Method Summary collapse
- #colored_stats ⇒ Object
- #colored_summary(options = nil) ⇒ Object
-
#initialize ⇒ Report
constructor
A new instance of Report.
- #stats ⇒ Object
- #summary(options = nil) ⇒ Object
- #unique_record_counts ⇒ Object
Constructor Details
#initialize ⇒ Report
Returns a new instance of Report.
9 10 11 12 13 |
# File 'lib/transpec/report.rb', line 9 def initialize @records = [] @context_errors = [] @syntax_errors = [] end |
Instance Attribute Details
#context_errors ⇒ Object (readonly)
Returns the value of attribute context_errors.
7 8 9 |
# File 'lib/transpec/report.rb', line 7 def context_errors @context_errors end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
7 8 9 |
# File 'lib/transpec/report.rb', line 7 def records @records end |
#syntax_errors ⇒ Object (readonly)
Returns the value of attribute syntax_errors.
7 8 9 |
# File 'lib/transpec/report.rb', line 7 def syntax_errors @syntax_errors end |
Instance Method Details
#colored_stats ⇒ Object
42 43 44 |
# File 'lib/transpec/report.rb', line 42 def colored_stats convertion_and_incomplete_stats + error_stats end |
#colored_summary(options = nil) ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/transpec/report.rb', line 25 def colored_summary( = nil) ||= { bullet: nil, separate_by_blank_line: false } summary = '' unique_record_counts.each do |record, count| summary << "\n" if [:separate_by_blank_line] && !summary.empty? summary << format_record(record, count, [:bullet]) end summary end |
#stats ⇒ Object
46 47 48 |
# File 'lib/transpec/report.rb', line 46 def stats without_color { colored_stats } end |
#summary(options = nil) ⇒ Object
38 39 40 |
# File 'lib/transpec/report.rb', line 38 def summary( = nil) without_color { colored_summary() } end |
#unique_record_counts ⇒ Object
15 16 17 18 19 20 21 22 23 |
# File 'lib/transpec/report.rb', line 15 def unique_record_counts record_counts = Hash.new(0) records.each do |record| record_counts[record] += 1 end Hash[record_counts.sort_by { |record, count| -count }] end |