Sha256: 227f8ea555cf359a3ac31f7903c879bc33cb1975a0036c4b1ed729bbae33e4bb

Contents?: true

Size: 705 Bytes

Versions: 5

Compression:

Stored size: 705 Bytes

Contents

require 'set'
require 'reek/smells/smell_detector'

module Reek
  class Report
    include Enumerable

    def initialize  # :nodoc:
      @report = SortedSet.new
    end

    def each
      @report.each { |smell| yield smell }
    end

    def <<(smell)  # :nodoc:
      @report << smell
      true
    end
    
    def empty?  # :nodoc:
      @report.empty?
    end

    def length  # :nodoc:
      @report.length
    end
    
    alias size length

    def [](index)  # :nodoc:
      @report.to_a[index]
    end

    # Creates a formatted report of all the +Smells::SmellWarning+ objects recorded in
    # this report.
    def to_s
      @report.map {|smell| smell.report}.join("\n")
    end
  end

end

Version data entries

5 entries across 5 versions & 2 rubygems

Version Path
kevinrutherford-reek-0.3.1.4 lib/reek/report.rb
kevinrutherford-reek-0.3.1.5 lib/reek/report.rb
kevinrutherford-reek-0.3.1.6 lib/reek/report.rb
kevinrutherford-reek-1.0.0 lib/reek/report.rb
reek-1.0.0 lib/reek/report.rb