Class: Reek::Report

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

Instance Method Summary collapse

Constructor Details

#initializeReport

: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

#eachObject

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

Returns:

  • (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

#lengthObject Also known as: size



28
29
30
# File 'lib/reek/report.rb', line 28

def length
  @report.length
end

#to_sObject

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