Class: NauktisUtils::Duplicate::HandlingStrategy::Analyse
- Inherits:
-
Object
- Object
- NauktisUtils::Duplicate::HandlingStrategy::Analyse
- Defined in:
- lib/nauktis_utils/duplicate.rb
Instance Attribute Summary collapse
-
#counters ⇒ Object
readonly
Returns the value of attribute counters.
Instance Method Summary collapse
- #handle(files) ⇒ Object
-
#initialize ⇒ Analyse
constructor
A new instance of Analyse.
Constructor Details
#initialize ⇒ Analyse
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
#counters ⇒ Object (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 |