buildr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r689308 - /incubator/buildr/trunk/lib/buildr/core/test.rb
Date Wed, 27 Aug 2008 00:49:35 GMT
Author: assaf
Date: Tue Aug 26 17:49:35 2008
New Revision: 689308

URL: http://svn.apache.org/viewvc?rev=689308&view=rev
Log:
Even better than inject, [].max.

Modified:
    incubator/buildr/trunk/lib/buildr/core/test.rb

Modified: incubator/buildr/trunk/lib/buildr/core/test.rb
URL: http://svn.apache.org/viewvc/incubator/buildr/trunk/lib/buildr/core/test.rb?rev=689308&r1=689307&r2=689308&view=diff
==============================================================================
--- incubator/buildr/trunk/lib/buildr/core/test.rb (original)
+++ incubator/buildr/trunk/lib/buildr/core/test.rb Tue Aug 26 17:49:35 2008
@@ -471,8 +471,7 @@
     end
 
     def needed? #:nodoc:
-      latest_prerequisite = @prerequisites.map { |p| application[p, @scope] }.
-        inject { |latest, task| task.timestamp > latest.timestamp ? task :latest }
+      latest_prerequisite = @prerequisites.map { |p| application[p, @scope] }.max { |a,b|
a.timestamp<=>b.timestamp }
       needed = (timestamp == Rake::EARLY) || latest_prerequisite.timestamp > timestamp
       trace "Testing#{needed ? ' ' : ' not '}needed. " +
         "Latest prerequisite change: #{latest_prerequisite.timestamp} (#{latest_prerequisite.to_s}).
" +



Mime
View raw message