19 lines
461 B
Ruby
19 lines
461 B
Ruby
|
require 'fastercsv'
|
||
|
|
||
|
module OutputToCSV
|
||
|
def self.output_results( filename, results )
|
||
|
FasterCSV.open( filename, 'w' ) do |csv|
|
||
|
# Iterate over each result set, which contains many results
|
||
|
results.each do |result_set|
|
||
|
columns, times = [], []
|
||
|
result_set.each do |result|
|
||
|
columns << result.description
|
||
|
times << result.tms.real
|
||
|
end
|
||
|
csv << columns
|
||
|
csv << times
|
||
|
end
|
||
|
end
|
||
|
end
|
||
|
end
|