[Groonga-commit] droonga/http-benchmark at 95bbd7e [master] Use CSV library

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Oct 9 16:43:13 JST 2013


YUKI Hiroshi	2013-10-09 16:43:13 +0900 (Wed, 09 Oct 2013)

  New Revision: 95bbd7e053daeb17ba80a15286356060f213cd91
  https://github.com/droonga/http-benchmark/commit/95bbd7e053daeb17ba80a15286356060f213cd91

  Message:
    Use CSV library

  Modified files:
    lib/droonga/http-benchmark/gradual-runner.rb

  Modified: lib/droonga/http-benchmark/gradual-runner.rb (+8 -7)
===================================================================
--- lib/droonga/http-benchmark/gradual-runner.rb    2013-10-09 16:32:43 +0900 (271cd6a)
+++ lib/droonga/http-benchmark/gradual-runner.rb    2013-10-09 16:43:13 +0900 (cd9589d)
@@ -1,6 +1,7 @@
 # -*- coding: utf-8 -*-
 
 require "droonga/http-benchmark/runner"
+require "csv"
 
 module Droonga
   module HttpBenchmark
@@ -56,7 +57,7 @@ module Droonga
         end
 
         def to_csv
-          "#{csv_header}\n#{csv_body}"
+          ([csv_header] + csv_body).to_csv
         end
 
         private
@@ -71,16 +72,16 @@ module Droonga
         end
 
         def csv_header
-          (Runner::Result.keys + response_statuses).join(",")
+          Runner::Result.keys + response_statuses
         end
 
         def csv_body
           @results.values.collect do |result|
-            (result.values +
-             response_statuses.collect do |status|
-               result.response_status_percentages[status] || 0
-             end).join(",")
-          end.join("\n")
+            result.values +
+            response_statuses.collect do |status|
+              result.response_status_percentages[status] || 0
+            end
+          end
         end
       end
     end
-------------- next part --------------
HTML����������������������������...
下载 



More information about the Groonga-commit mailing list
Back to archive index