Class: Reek::ReportList

Inherits:
Object show all
Includes:
Enumerable
Defined in:
lib/reek/report.rb

Instance Method Summary collapse

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

Returns:

  • (Boolean)


65
66
67
# File 'lib/reek/report.rb', line 65

def empty?
  length == 0
end

#lengthObject



69
70
71
# File 'lib/reek/report.rb', line 69

def length
  @sources.inject(0) {|sum, src| sum + src.report.length }
end

#smelly_sourcesObject



73
74
75
# File 'lib/reek/report.rb', line 73

def smelly_sources
  @sources.select {|src| src.smelly? }
end

#to_sObject



77
78
79
# File 'lib/reek/report.rb', line 77

def to_s
  smelly_sources.map { |src| src.full_report }.join("\n")
end