From b1f10502e6e75c2198efe22e527d688bcd3ad4a7 Mon Sep 17 00:00:00 2001 From: Xavier Noria Date: Tue, 12 Apr 2016 20:04:04 +0200 Subject: 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. --- activesupport/lib/active_support/file_update_checker.rb | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'activesupport/lib/active_support/file_update_checker.rb') 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 -- cgit v1.2.3