Class: CheckSumComparer
- Inherits:
-
Object
- Object
- CheckSumComparer
- Defined in:
- CheckSumCalculator.rb
Constant Summary
- @@caclulator =
CheckSumCalculator.new
- @@serializer =
nil
- @@new_folder =
nil
Instance Method Summary (collapse)
- - (Object) compare
-
- (CheckSumComparer) initialize(hashfile_path, new_folder)
constructor
A new instance of CheckSumComparer.
Constructor Details
- (CheckSumComparer) initialize(hashfile_path, new_folder)
Returns a new instance of CheckSumComparer
92 93 94 95 |
# File 'CheckSumCalculator.rb', line 92 def initialize(hashfile_path, new_folder) @@serializer = CheckSumSerializer.new(hashfile_path) @@new_folder = new_folder end |
Instance Method Details
- (Object) compare
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 |
# File 'CheckSumCalculator.rb', line 97 def compare new_hash = @@caclulator.calc(@@new_folder) if @@serializer.cansave @@serializer.save(new_hash) return true end old_hash = @@serializer.load() old_hash.each { |fhash| detect_files = new_hash.detect {|f| f["name"] == fhash["name"] } return true unless !detect_files.nil? if detect_files["md5"].eql?(fhash["md5"]) next else return true end } return false end |