class ActiveSupport::FileUpdateChecker
def max_mtime(paths)
Experimental RBS support (using type sampling data from the type_fusion
project).
def max_mtime: (Array[String] paths) -> Time
This signature was generated using 1 sample from 1 application.
healthy to consider this edge case because with mtimes in the future
can happen for example if the user changes the clock by hand. It is
Files with a mtime in the future are ignored. Such abnormal situation
if the array is empty.
This method returns the maximum mtime of the files in +paths+, or +nil+
def max_mtime(paths) time_now = Time.now max_mtime = nil # Time comparisons are performed with #compare_without_coercion because # AS redefines these operators in a way that is much slower and does not # bring any benefit in this particular code. # # Read t1.compare_without_coercion(t2) < 0 as t1 < t2. paths.each do |path| mtime = File.mtime(path) next if time_now.compare_without_coercion(mtime) < 0 if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0 max_mtime = mtime end end max_mtime end