Class: Rubycritic::SmellsStatusSetter

Inherits:
Object
  • Object
show all
Defined in:
lib/rubycritic/smells_status_setter.rb

Instance Method Summary collapse

Constructor Details

#initialize(smelly_pathnames_before, smelly_pathnames_now) ⇒ SmellsStatusSetter

Returns a new instance of SmellsStatusSetter.



4
5
6
7
# File 'lib/rubycritic/smells_status_setter.rb', line 4

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

Instance Method Details

#smelly_pathnamesObject



9
10
11
12
13
14
15
16
17
18
# File 'lib/rubycritic/smells_status_setter.rb', line 9

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