lib/rbbt/persist.rb in rbbt-util-5.17.5 vs lib/rbbt/persist.rb in rbbt-util-5.17.6
- old
+ new
@@ -25,22 +25,23 @@
MEMORY = {} unless defined? MEMORY
MAX_FILE_LENGTH = 150
def self.newer?(path, file)
return true if not Open.exists? file
- return true if File.mtime(path) < File.mtime(file)
+ return File.mtime(path) - File.mtime(file) if File.mtime(path) < File.mtime(file)
return false
end
def self.is_persisted?(path, persist_options = {})
return false if not Open.exists? path
return false if TrueClass === persist_options[:update]
check = persist_options[:check]
if not check.nil?
if Array === check
- if check.select{|file| newer? path, file}.any?
- Log.medium "Persistence check for #{path} failed in: #{ check.select{|file| newer? path, file} * ", "}"
+ newer = check.select{|file| newer? path, file}
+ if newer.any?
+ Log.medium "Persistence check for #{path} failed in: #{ newer * ", "}"
return false
end
else
return false if newer? path, check
end