Class: Reek::ReportList
- Includes:
- Enumerable
- Defined in:
- lib/reek/report.rb
Instance Method Summary collapse
-
#each(&blk) ⇒ Object
Yields, in turn, each SmellWarning in every report in this report.
- #empty? ⇒ Boolean
-
#initialize(sources) ⇒ ReportList
constructor
A new instance of ReportList.
- #length ⇒ Object
- #smelly_sources ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(sources) ⇒ ReportList
Returns a new instance of ReportList.
54 55 56 |
# File 'lib/reek/report.rb', line 54 def initialize(sources) @sources = sources end |
Instance Method Details
#each(&blk) ⇒ Object
Yields, in turn, each SmellWarning in every report in this report.
61 62 63 |
# File 'lib/reek/report.rb', line 61 def each(&blk) @sources.each {|src| src.report.each(&blk) } end |
#empty? ⇒ Boolean
65 66 67 |
# File 'lib/reek/report.rb', line 65 def empty? length == 0 end |
#length ⇒ Object
69 70 71 |
# File 'lib/reek/report.rb', line 69 def length @sources.inject(0) {|sum, src| sum + src.report.length } end |
#smelly_sources ⇒ Object
73 74 75 |
# File 'lib/reek/report.rb', line 73 def smelly_sources @sources.select {|src| src.smelly? } end |
#to_s ⇒ Object
77 78 79 |
# File 'lib/reek/report.rb', line 77 def to_s smelly_sources.map { |src| src.full_report }.join("\n") end |