aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorJeremy Kemper <jeremy@bitsweat.net>2008-06-14 03:29:30 -0700
committerJeremy Kemper <jeremy@bitsweat.net>2008-06-14 03:29:30 -0700
commit01a4af4a74fdcda9a20db8de01fd7bb5d28d22cf (patch)
tree9e1f74d0084bafaf3dab16b889368d949c8b22d5 /activesupport
parente3623bd9ed71e289078cefad4204f38d2fdf9188 (diff)
downloadrails-01a4af4a74fdcda9a20db8de01fd7bb5d28d22cf.tar.gz
rails-01a4af4a74fdcda9a20db8de01fd7bb5d28d22cf.tar.bz2
rails-01a4af4a74fdcda9a20db8de01fd7bb5d28d22cf.zip
Pass printer class to output_filename
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/lib/active_support/testing/performance.rb16
1 files changed, 8 insertions, 8 deletions
diff --git a/activesupport/lib/active_support/testing/performance.rb b/activesupport/lib/active_support/testing/performance.rb
index 11dd720e9f..38722ecb8b 100644
--- a/activesupport/lib/active_support/testing/performance.rb
+++ b/activesupport/lib/active_support/testing/performance.rb
@@ -167,7 +167,7 @@ module ActiveSupport
def record_profile(test_name, data, measure_mode)
printer_classes.each do |printer_class|
- fname = output_filename(test_name, printer, measure_mode)
+ fname = output_filename(test_name, printer_class, measure_mode)
FileUtils.mkdir_p(File.dirname(fname))
File.open(fname, 'wb') do |file|
@@ -177,14 +177,14 @@ module ActiveSupport
end
# The report filename is test_name + measure_mode + report_type
- def output_filename(test_name, printer, measure_mode)
+ def output_filename(test_name, printer_class, measure_mode)
suffix =
- case printer
- when RubyProf::FlatPrinter; 'flat.txt'
- when RubyProf::GraphPrinter; 'graph.txt'
- when RubyProf::GraphHtmlPrinter; 'graph.html'
- when RubyProf::CallTreePrinter; 'tree.txt'
- else printer.to_s.downcase
+ case printer_class.name.demodulize
+ when 'FlatPrinter'; 'flat.txt'
+ when 'GraphPrinter'; 'graph.txt'
+ when 'GraphHtmlPrinter'; 'graph.html'
+ when 'CallTreePrinter'; 'tree.txt'
+ else printer_class.name.sub(/Printer$/, '').underscore
end
"#{profile_options[:output]}/#{test_name}_#{ActiveSupport::Testing::Performance::Util.metric_name(measure_mode)}_#{suffix}"