Sha256: 7d5d92f7112de0278869b22056400cba82e1cc4152015ccc2ad8743ae56b7c3b

Contents?: true

Size: 611 Bytes

Versions: 11

Compression:

Stored size: 611 Bytes

Contents

module Preek
  # A smelly file
  class SmellFile

    def initialize(examiner)
      @examiner = examiner
      @klasses = {}
      add_smells_to_klasses
    end

    def file
      @examiner.description
    end

    alias :filename :file

    def klasses
      return @klasses unless block_given?
      @klasses.each do |name, klass|
        yield klass
      end
    end

  private
    def add_smells_to_klasses
      @examiner.smells.each do |smell|
        find(smell.klass) << smell
      end
    end

    def find(klassname)
      @klasses[klassname.to_sym] ||= SmellKlass.new(klassname)
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
preek-1.7.0 lib/preek/smell_file.rb
preek-1.6.0 lib/preek/smell_file.rb
preek-1.5.1 lib/preek/smell_file.rb
preek-1.5.0 lib/preek/smell_file.rb
preek-1.4.3 lib/preek/smell_file.rb
preek-1.4.2 lib/preek/smell_file.rb
preek-1.4.1 lib/preek/smell_file.rb
preek-1.4.0 lib/preek/smell_file.rb
preek-1.3.2 lib/preek/smell_file.rb
preek-1.3.1 lib/preek/smell_file.rb
preek-1.2.1 lib/preek/smell_file.rb