Class: NauktisUtils::Duplicate::HandlingStrategy::Analyse

Inherits:
Object
  • Object
show all
Defined in:
lib/nauktis_utils/duplicate.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAnalyse

Returns a new instance of Analyse.



81
82
83
# File 'lib/nauktis_utils/duplicate.rb', line 81

def initialize
  @counters = Hash.new(0)
end

Instance Attribute Details

#countersObject (readonly)

Returns the value of attribute counters.



80
81
82
# File 'lib/nauktis_utils/duplicate.rb', line 80

def counters
  @counters
end

Instance Method Details

#handle(files) ⇒ Object



85
86
87
88
89
# File 'lib/nauktis_utils/duplicate.rb', line 85

def handle(files)
  @counters[:pairs] += 1
  @counters[:duplicates] += (files.size - 1)
  @counters[:size] += ((files.size - 1) * File.size(files.first))
end