Class: Reek::Report
Instance Method Summary collapse
-
#<<(smell) ⇒ Object
:nodoc:.
-
#[](index) ⇒ Object
:nodoc:.
-
#each ⇒ Object
Yields, in turn, each SmellWarning in this report.
- #empty? ⇒ Boolean
-
#full_report(desc) ⇒ Object
Creates a formatted report of all the
Smells::SmellWarning
objects recorded in this report, with a heading. -
#initialize ⇒ Report
constructor
:nodoc:.
- #length ⇒ Object (also: #size)
-
#to_s ⇒ Object
Creates a formatted report of all the
Smells::SmellWarning
objects recorded in this report.
Constructor Details
#initialize ⇒ Report
:nodoc:
8 9 10 |
# File 'lib/reek/report.rb', line 8 def initialize # :nodoc: @report = SortedSet.new end |
Instance Method Details
#<<(smell) ⇒ Object
:nodoc:
19 20 21 22 |
# File 'lib/reek/report.rb', line 19 def <<(smell) # :nodoc: @report << smell true end |
#[](index) ⇒ Object
:nodoc:
34 35 36 |
# File 'lib/reek/report.rb', line 34 def [](index) # :nodoc: @report.to_a[index] end |
#each ⇒ Object
Yields, in turn, each SmellWarning in this report.
15 16 17 |
# File 'lib/reek/report.rb', line 15 def each @report.each { |smell| yield smell } end |
#empty? ⇒ Boolean
24 25 26 |
# File 'lib/reek/report.rb', line 24 def empty? @report.empty? end |
#full_report(desc) ⇒ Object
Creates a formatted report of all the Smells::SmellWarning
objects recorded in this report, with a heading.
40 41 42 |
# File 'lib/reek/report.rb', line 40 def full_report(desc) "\"#{desc}\" -- #{length} warnings:\n#{to_s}\n" end |
#length ⇒ Object Also known as: size
28 29 30 |
# File 'lib/reek/report.rb', line 28 def length @report.length end |
#to_s ⇒ Object
Creates a formatted report of all the Smells::SmellWarning
objects recorded in this report.
46 47 48 |
# File 'lib/reek/report.rb', line 46 def to_s @report.map {|smell| smell.report}.join("\n") end |