Sha256: 85b552feedfe8608eb4f1a34541048f3adde6b20ccf249e238b558ac0d993f4b

Contents?: true

Size: 714 Bytes

Versions: 6

Compression:

Stored size: 714 Bytes

Contents

module Rubycritic

  class SmellsStatusSetter
    def initialize(smelly_pathnames_before, smelly_pathnames_now)
      @smelly_pathnames_before = smelly_pathnames_before
      @smelly_pathnames_now = smelly_pathnames_now
    end

    def smelly_pathnames
      @smelly_pathnames_now.each do |pathname, smells_now|
        smells_before = @smelly_pathnames_before[pathname] || []
        old_smells = smells_now & smells_before
        set_status(old_smells, :old)
        new_smells = smells_now - smells_before
        set_status(new_smells, :new)
      end
      @smelly_pathnames_now
    end

    private

    def set_status(smells, status)
      smells.each { |smell| smell.status = status }
    end
  end

end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
rubycritic-0.0.7 lib/rubycritic/smells_status_setter.rb
rubycritic-0.0.6 lib/rubycritic/smells_status_setter.rb
rubycritic-0.0.5 lib/rubycritic/smells_status_setter.rb
rubycritic-0.0.4 lib/rubycritic/smells_status_setter.rb
rubycritic-0.0.3 lib/rubycritic/smells_status_setter.rb
rubycritic-0.0.2 lib/rubycritic/smells_status_setter.rb