instance method
FileUtils#uptodate?
(::FileUtils::path new, ::_Each[::FileUtils::path] old_list) -> bool
uptodate?(new, old_list)
lib/fileutils.rb
View on GitHub ↗
# File tmp/rubies/ruby-4.0.0/lib/fileutils.rb, line 265
def uptodate?(new, old_list)
return false unless File.exist?(new)
new_time = File.mtime(new)
old_list.each do |old|
if File.exist?(old)
return false unless new_time > File.mtime(old)
end
end
true
end
Returns true if the file at path new is newer than all the files at paths in array old_list; false otherwise.
Argument new and the elements of old_list should be interpretable as paths:
Example
FileUtils.uptodate?('Rakefile', ['Gemfile', 'README.md']) # => true FileUtils.uptodate?('Gemfile', ['Rakefile', 'README.md']) # => false
A non-existent file is considered to be infinitely old.
Related: FileUtils.touch.