diff options
author | Xavier Noria <fxn@hashref.com> | 2016-04-12 20:04:04 +0200 |
---|---|---|
committer | Xavier Noria <fxn@hashref.com> | 2016-04-12 20:09:06 +0200 |
commit | b1f10502e6e75c2198efe22e527d688bcd3ad4a7 (patch) | |
tree | a1a503d81e1768ab623769bd78f764b309d17d72 /activesupport/lib/active_support | |
parent | a08efa1065aefaa92fb2aee4c15b59b4fed7d07d (diff) | |
download | rails-b1f10502e6e75c2198efe22e527d688bcd3ad4a7.tar.gz rails-b1f10502e6e75c2198efe22e527d688bcd3ad4a7.tar.bz2 rails-b1f10502e6e75c2198efe22e527d688bcd3ad4a7.zip |
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.
Diffstat (limited to 'activesupport/lib/active_support')
-rw-r--r-- | activesupport/lib/active_support/file_update_checker.rb | 13 |
1 files changed, 5 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/file_update_checker.rb b/activesupport/lib/active_support/file_update_checker.rb index fa0b1a4bcf..43e8b7c528 100644 --- a/activesupport/lib/active_support/file_update_checker.rb +++ b/activesupport/lib/active_support/file_update_checker.rb @@ -114,19 +114,16 @@ module ActiveSupport 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 |