copy edits some comments [ci skip]

Note that the fact that mtimes in the future are ignore was documented
just a few lines above. Since we know this has to be done, and the code
is quite clear due to variable naming, I think we can get rid of the
comment in the middle of the loop and shorten it even further.
This commit is contained in:
Xavier Noria 2016-04-12 20:04:04 +02:00
parent a08efa1065
commit b1f10502e6

@ -114,19 +114,16 @@ 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)
# Prevent dates in the future being considered
# Equivalent ruby:
# time.now < mtime
next if time_now.compare_without_coercion(mtime) < 0
# This avoids ActiveSupport::CoreExt::Time#time_with_coercion
# which is super slow when comparing two Time objects
#
# Equivalent Ruby:
# max_mtime.nil? || max_mtime < mtime
if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0
max_mtime = mtime
end