Class: CheckSumComparer
Constant Summary collapse
- @@caclulator =
CheckSumCalculator.new
- @@serializer =
nil
- @@new_folder =
nil
Instance Method Summary collapse
- #compare ⇒ Object
-
#initialize(hashfile_path, new_folder) ⇒ CheckSumComparer
constructor
A new instance of CheckSumComparer.
Constructor Details
#initialize(hashfile_path, new_folder) ⇒ CheckSumComparer
Returns a new instance of CheckSumComparer.
92 93 94 95 |
# File 'lib/build/CheckSumCalculator.rb', line 92 def initialize(hashfile_path, new_folder) @@serializer = CheckSumSerializer.new(hashfile_path) @@new_folder = new_folder end |
Instance Method Details
#compare ⇒ Object
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 'lib/build/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 |