[前][次][番号順一覧][スレッド一覧]

ruby-changes:37773

From: nobu <ko1@a...>
Date: Thu, 5 Mar 2015 16:01:40 +0900 (JST)
Subject: [ruby-changes:37773] nobu:r49854 (trunk): driver.rb: fix index

nobu	2015-03-05 16:01:26 +0900 (Thu, 05 Mar 2015)

  New Revision: 49854

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49854

  Log:
    driver.rb: fix index
    
    * benchmark/driver.rb (show_results): fix index of results.

  Modified files:
    trunk/benchmark/driver.rb
Index: benchmark/driver.rb
===================================================================
--- benchmark/driver.rb	(revision 49853)
+++ benchmark/driver.rb	(revision 49854)
@@ -168,10 +168,10 @@ class BenchmarkDriver https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L168
     output if markdown
     output ["name".ljust(name_width), @execs.map.with_index{|(_, v), i| sprintf(strformat, v, width[i])}].join("").rstrip
     output ["-"*name_width, width.map{|n|":".rjust(n, "-")}].join("|") if markdown
-    @results.each_with_index{|(v, result), i|
+    @results.each{|v, result|
       rets = []
       s = adjusted_results(v, result){|r|
-        rets << sprintf(numformat, r, width[i])
+        rets << sprintf(numformat, r, width[rets.size])
       }
       v += s if s
       output [v.ljust(name_width), rets].join("")
@@ -183,7 +183,7 @@ class BenchmarkDriver https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L183
       output if markdown
       output ["name".ljust(name_width), @execs[1..-1].map.with_index{|(_, v), i| sprintf(strformat, v, width[i])}].join("").rstrip
       output ["-"*name_width, width[1..-1].map{|n|":".rjust(n, "-")}].join("|") if markdown
-      @results.each_with_index{|(v, result), i|
+      @results.each{|v, result|
         rets = []
         first_value = nil
         s = adjusted_results(v, result){|r|
@@ -191,7 +191,7 @@ class BenchmarkDriver https://github.com/ruby/ruby/blob/trunk/benchmark/driver.rb#L191
             if r == 0
               rets << "Error"
             else
-              rets << sprintf(numformat, first_value/r, width[i])
+              rets << sprintf(numformat, first_value/r, width[rets.size+1])
             end
           else
             first_value = r

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]