mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
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:
parent
a08efa1065
commit
b1f10502e6
1 changed files with 5 additions and 8 deletions
|
@ -114,19 +114,16 @@ module ActiveSupport
|
||||||
time_now = Time.now
|
time_now = Time.now
|
||||||
max_mtime = nil
|
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|
|
paths.each do |path|
|
||||||
mtime = File.mtime(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
|
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
|
if max_mtime.nil? || max_mtime.compare_without_coercion(mtime) < 0
|
||||||
max_mtime = mtime
|
max_mtime = mtime
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue