instance method max_mtime

Ruby on Rails 4.2.9

Since v4.0.13 Private

Available in: v4.0.13 v4.1.16 v4.2.9 v5.2.8.1 v6.0.6 v6.1.7.10 v7.0.10 v7.1.6 v7.2.3 v8.0.4 v8.1.2

Signature

max_mtime(paths)

This method returns the maximum mtime of the files in paths, or nil if the array is empty.

Files with a mtime in the future are ignored. Such abnormal situation can happen for example if the user changes the clock by hand. It is healthy to consider this edge case because with mtimes in the future reloading is not triggered.

Parameters

paths req
Source
# File activesupport/lib/active_support/file_update_checker.rb, line 112
    def max_mtime(paths)
      time_now = Time.now
      paths.map {|path| File.mtime(path)}.reject {|mtime| time_now < mtime}.max
    end

Defined in activesupport/lib/active_support/file_update_checker.rb line 112 · View on GitHub · Improve this page · Find usages on GitHub

Defined in ActiveSupport::FileUpdateChecker

Type at least 2 characters to search.

↑↓ navigate · open · esc close